Revision: 22733
Author: [email protected]
Date: Thu Jul 31 07:50:26 2014 UTC
Log: Fix issue with storing 31-bit bitfield as Smi.
[email protected]
Review URL: https://codereview.chromium.org/428183003
http://code.google.com/p/v8/source/detail?r=22733
Modified:
/branches/bleeding_edge/src/code-stubs.h
/branches/bleeding_edge/src/objects-inl.h
/branches/bleeding_edge/src/objects.h
=======================================
--- /branches/bleeding_edge/src/code-stubs.h Wed Jul 30 13:54:45 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.h Thu Jul 31 07:50:26 2014 UTC
@@ -1617,7 +1617,9 @@
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);
@@ -1636,7 +1638,9 @@
// 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 {
=======================================
--- /branches/bleeding_edge/src/objects-inl.h Wed Jul 30 13:54:45 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h Thu Jul 31 07:50:26 2014 UTC
@@ -6182,13 +6182,14 @@
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));
}
=======================================
--- /branches/bleeding_edge/src/objects.h Wed Jul 30 13:54:45 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Thu Jul 31 07:50:26 2014 UTC
@@ -305,8 +305,10 @@
// 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.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.