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 |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 ContextLookupFlags flags, | 565 ContextLookupFlags flags, |
566 int* index, | 566 int* index, |
567 PropertyAttributes* attributes, | 567 PropertyAttributes* attributes, |
568 BindingFlags* binding_flags); | 568 BindingFlags* binding_flags); |
569 | 569 |
570 // Code generation support. | 570 // Code generation support. |
571 static int SlotOffset(int index) { | 571 static int SlotOffset(int index) { |
572 return kHeaderSize + index * kPointerSize - kHeapObjectTag; | 572 return kHeaderSize + index * kPointerSize - kHeapObjectTag; |
573 } | 573 } |
574 | 574 |
575 static int FunctionMapIndex(StrictMode strict_mode, FunctionKind kind) { | 575 static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) { |
576 if (IsGeneratorFunction(kind)) { | 576 if (IsGeneratorFunction(kind)) { |
577 return strict_mode == SLOPPY ? SLOPPY_GENERATOR_FUNCTION_MAP_INDEX | 577 return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX |
578 : STRICT_GENERATOR_FUNCTION_MAP_INDEX; | 578 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; |
579 } | 579 } |
580 | 580 |
581 if (IsArrowFunction(kind) || IsConciseMethod(kind)) { | 581 if (IsArrowFunction(kind) || IsConciseMethod(kind)) { |
582 return strict_mode == SLOPPY | 582 return is_strict(language_mode) |
583 ? SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX | 583 ? STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX |
584 : STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; | 584 : SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; |
585 } | 585 } |
586 | 586 |
587 return strict_mode == SLOPPY ? SLOPPY_FUNCTION_MAP_INDEX | 587 return is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX |
588 : STRICT_FUNCTION_MAP_INDEX; | 588 : SLOPPY_FUNCTION_MAP_INDEX; |
589 } | 589 } |
590 | 590 |
591 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; | 591 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; |
592 | 592 |
593 // GC support. | 593 // GC support. |
594 typedef FixedBodyDescriptor< | 594 typedef FixedBodyDescriptor< |
595 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; | 595 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; |
596 | 596 |
597 typedef FixedBodyDescriptor< | 597 typedef FixedBodyDescriptor< |
598 kHeaderSize, | 598 kHeaderSize, |
(...skipping 10 matching lines...) Expand all Loading... |
609 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 609 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
610 #endif | 610 #endif |
611 | 611 |
612 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 612 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
613 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 613 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
614 }; | 614 }; |
615 | 615 |
616 } } // namespace v8::internal | 616 } } // namespace v8::internal |
617 | 617 |
618 #endif // V8_CONTEXTS_H_ | 618 #endif // V8_CONTEXTS_H_ |
OLD | NEW |