| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
| 6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2436 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); | 2436 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); |
| 2437 }; | 2437 }; |
| 2438 | 2438 |
| 2439 | 2439 |
| 2440 class ScriptContextFieldStub : public HandlerStub { | 2440 class ScriptContextFieldStub : public HandlerStub { |
| 2441 public: | 2441 public: |
| 2442 ScriptContextFieldStub(Isolate* isolate, | 2442 ScriptContextFieldStub(Isolate* isolate, |
| 2443 const ScriptContextTable::LookupResult* lookup_result) | 2443 const ScriptContextTable::LookupResult* lookup_result) |
| 2444 : HandlerStub(isolate) { | 2444 : HandlerStub(isolate) { |
| 2445 DCHECK(Accepted(lookup_result)); | 2445 DCHECK(Accepted(lookup_result)); |
| 2446 STATIC_ASSERT(kContextIndexBits + kSlotIndexBits <= kSubMinorKeyBits); |
| 2446 set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) | | 2447 set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) | |
| 2447 SlotIndexBits::encode(lookup_result->slot_index)); | 2448 SlotIndexBits::encode(lookup_result->slot_index)); |
| 2448 } | 2449 } |
| 2449 | 2450 |
| 2450 int context_index() const { | 2451 int context_index() const { |
| 2451 return ContextIndexBits::decode(sub_minor_key()); | 2452 return ContextIndexBits::decode(sub_minor_key()); |
| 2452 } | 2453 } |
| 2453 | 2454 |
| 2454 int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); } | 2455 int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); } |
| 2455 | 2456 |
| 2456 static bool Accepted(const ScriptContextTable::LookupResult* lookup_result) { | 2457 static bool Accepted(const ScriptContextTable::LookupResult* lookup_result) { |
| 2457 return ContextIndexBits::is_valid(lookup_result->context_index) && | 2458 return ContextIndexBits::is_valid(lookup_result->context_index) && |
| 2458 SlotIndexBits::is_valid(lookup_result->slot_index); | 2459 SlotIndexBits::is_valid(lookup_result->slot_index); |
| 2459 } | 2460 } |
| 2460 | 2461 |
| 2461 private: | 2462 private: |
| 2462 static const int kContextIndexBits = 13; | 2463 static const int kContextIndexBits = 9; |
| 2463 static const int kSlotIndexBits = 13; | 2464 static const int kSlotIndexBits = 13; |
| 2464 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {}; | 2465 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {}; |
| 2465 class SlotIndexBits | 2466 class SlotIndexBits |
| 2466 : public BitField<int, kContextIndexBits, kSlotIndexBits> {}; | 2467 : public BitField<int, kContextIndexBits, kSlotIndexBits> {}; |
| 2467 | 2468 |
| 2468 Code::StubType GetStubType() const override { return Code::FAST; } | 2469 Code::StubType GetStubType() const override { return Code::FAST; } |
| 2469 | 2470 |
| 2470 DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, HandlerStub); | 2471 DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, HandlerStub); |
| 2471 }; | 2472 }; |
| 2472 | 2473 |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3064 #undef DEFINE_HYDROGEN_CODE_STUB | 3065 #undef DEFINE_HYDROGEN_CODE_STUB |
| 3065 #undef DEFINE_CODE_STUB | 3066 #undef DEFINE_CODE_STUB |
| 3066 #undef DEFINE_CODE_STUB_BASE | 3067 #undef DEFINE_CODE_STUB_BASE |
| 3067 | 3068 |
| 3068 extern Representation RepresentationFromType(Type* type); | 3069 extern Representation RepresentationFromType(Type* type); |
| 3069 | 3070 |
| 3070 } // namespace internal | 3071 } // namespace internal |
| 3071 } // namespace v8 | 3072 } // namespace v8 |
| 3072 | 3073 |
| 3073 #endif // V8_CODE_STUBS_H_ | 3074 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |