class CallFunctionStub: public PlatformCodeStub {
public:
CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags)
- : PlatformCodeStub(isolate), argc_(argc), flags_(flags) { }
+ : PlatformCodeStub(isolate), argc_(argc), flags_(flags) {
+ ASSERT(argc <= Code::kMaxArguments);
+ }
void Generate(MacroAssembler* masm);
// Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
class FlagBits: public BitField<CallFunctionFlags, 0, 2> {};
- class ArgcBits: public BitField<unsigned, 2, 32 - 2> {};
+ class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {};
+
+ STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);
Major MajorKey() const { return CallFunction; }
int MinorKey() const {
uint32_t Code::stub_key() {
ASSERT(IsCodeStubOrIC());
- return Smi::cast(raw_type_feedback_info())->value() - Smi::kMinValue;
+ Smi* smi_key = Smi::cast(raw_type_feedback_info());
+ return static_cast<uint32_t>(smi_key->value());
}
void Code::set_stub_key(uint32_t key) {
ASSERT(IsCodeStubOrIC());
- set_raw_type_feedback_info(Smi::FromInt(key + Smi::kMinValue));
+ set_raw_type_feedback_info(Smi::FromInt(key));
}
// Instance size sentinel for objects of variable size.
const int kVariableSizeSentinel = 0;
+// We may store the unsigned bit field as signed Smi value and do not
+// use the sign bit.
const int kStubMajorKeyBits = 7;
-const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits;
+const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
// All Maps have a field instance_type containing a InstanceType.
// It describes the type of the instances.