| 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_CONTEXTS_H_ | 5 #ifndef V8_CONTEXTS_H_ |
| 6 #define V8_CONTEXTS_H_ | 6 #define V8_CONTEXTS_H_ |
| 7 | 7 |
| 8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 | 10 |
| 11 |
| 11 namespace v8 { | 12 namespace v8 { |
| 12 namespace internal { | 13 namespace internal { |
| 13 | 14 |
| 14 | 15 |
| 15 enum ContextLookupFlags { | 16 enum ContextLookupFlags { |
| 16 FOLLOW_CONTEXT_CHAIN = 1, | 17 FOLLOW_CONTEXT_CHAIN = 1, |
| 17 FOLLOW_PROTOTYPE_CHAIN = 2, | 18 FOLLOW_PROTOTYPE_CHAIN = 2, |
| 18 | 19 |
| 19 DONT_FOLLOW_CHAINS = 0, | 20 DONT_FOLLOW_CHAINS = 0, |
| 20 FOLLOW_CHAINS = FOLLOW_CONTEXT_CHAIN | FOLLOW_PROTOTYPE_CHAIN | 21 FOLLOW_CHAINS = FOLLOW_CONTEXT_CHAIN | FOLLOW_PROTOTYPE_CHAIN |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 ContextLookupFlags flags, | 545 ContextLookupFlags flags, |
| 545 int* index, | 546 int* index, |
| 546 PropertyAttributes* attributes, | 547 PropertyAttributes* attributes, |
| 547 BindingFlags* binding_flags); | 548 BindingFlags* binding_flags); |
| 548 | 549 |
| 549 // Code generation support. | 550 // Code generation support. |
| 550 static int SlotOffset(int index) { | 551 static int SlotOffset(int index) { |
| 551 return kHeaderSize + index * kPointerSize - kHeapObjectTag; | 552 return kHeaderSize + index * kPointerSize - kHeapObjectTag; |
| 552 } | 553 } |
| 553 | 554 |
| 554 static int FunctionMapIndex(StrictMode strict_mode, bool is_generator) { | 555 static int FunctionMapIndex(StrictMode strict_mode, FunctionKind kind) { |
| 555 return is_generator | 556 if (kind == FunctionKind::kGeneratorFunction) { |
| 556 ? (strict_mode == SLOPPY | 557 return strict_mode == SLOPPY ? SLOPPY_GENERATOR_FUNCTION_MAP_INDEX |
| 557 ? SLOPPY_GENERATOR_FUNCTION_MAP_INDEX | 558 : STRICT_GENERATOR_FUNCTION_MAP_INDEX; |
| 558 : STRICT_GENERATOR_FUNCTION_MAP_INDEX) | 559 } |
| 559 : (strict_mode == SLOPPY | 560 |
| 560 ? SLOPPY_FUNCTION_MAP_INDEX | 561 if (kind == FunctionKind::kConciseMethod) { |
| 561 : STRICT_FUNCTION_MAP_INDEX); | 562 return strict_mode == SLOPPY |
| 563 ? SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX |
| 564 : STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; |
| 565 } |
| 566 |
| 567 return strict_mode == SLOPPY ? SLOPPY_FUNCTION_MAP_INDEX |
| 568 : STRICT_FUNCTION_MAP_INDEX; |
| 562 } | 569 } |
| 563 | 570 |
| 564 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; | 571 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; |
| 565 | 572 |
| 566 // GC support. | 573 // GC support. |
| 567 typedef FixedBodyDescriptor< | 574 typedef FixedBodyDescriptor< |
| 568 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; | 575 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; |
| 569 | 576 |
| 570 typedef FixedBodyDescriptor< | 577 typedef FixedBodyDescriptor< |
| 571 kHeaderSize, | 578 kHeaderSize, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 582 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 589 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
| 583 #endif | 590 #endif |
| 584 | 591 |
| 585 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 592 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
| 586 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 593 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
| 587 }; | 594 }; |
| 588 | 595 |
| 589 } } // namespace v8::internal | 596 } } // namespace v8::internal |
| 590 | 597 |
| 591 #endif // V8_CONTEXTS_H_ | 598 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |