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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 } | 575 } |
576 | 576 |
577 static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) { | 577 static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) { |
578 if (IsGeneratorFunction(kind)) { | 578 if (IsGeneratorFunction(kind)) { |
579 return is_strong(language_mode) ? STRONG_GENERATOR_FUNCTION_MAP_INDEX : | 579 return is_strong(language_mode) ? STRONG_GENERATOR_FUNCTION_MAP_INDEX : |
580 is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX | 580 is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX |
581 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; | 581 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; |
582 } | 582 } |
583 | 583 |
584 if (IsConstructor(kind)) { | 584 if (IsConstructor(kind)) { |
585 return is_strong(language_mode) ? STRONG_CONSTRUCTOR_MAP_INDEX : | 585 // Use strict function map (no own "caller" / "arguments") |
586 is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX | 586 return is_strong(language_mode) ? STRONG_CONSTRUCTOR_MAP_INDEX |
587 : SLOPPY_FUNCTION_MAP_INDEX; | 587 : STRICT_FUNCTION_MAP_INDEX; |
588 } | 588 } |
589 | 589 |
590 if (IsArrowFunction(kind) || IsConciseMethod(kind) || | 590 if (IsArrowFunction(kind) || IsConciseMethod(kind) || |
591 IsAccessorFunction(kind)) { | 591 IsAccessorFunction(kind)) { |
592 return is_strong(language_mode) ? STRONG_FUNCTION_MAP_INDEX : | 592 return is_strong(language_mode) |
593 is_strict(language_mode) ? | 593 ? STRONG_FUNCTION_MAP_INDEX |
594 STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX : | 594 : STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; |
595 SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; | |
596 } | 595 } |
597 | 596 |
598 return is_strong(language_mode) ? STRONG_FUNCTION_MAP_INDEX : | 597 return is_strong(language_mode) ? STRONG_FUNCTION_MAP_INDEX : |
599 is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX | 598 is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX |
600 : SLOPPY_FUNCTION_MAP_INDEX; | 599 : SLOPPY_FUNCTION_MAP_INDEX; |
601 } | 600 } |
602 | 601 |
603 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; | 602 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; |
604 | 603 |
605 // GC support. | 604 // GC support. |
(...skipping 15 matching lines...) Expand all Loading... |
621 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 620 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
622 #endif | 621 #endif |
623 | 622 |
624 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 623 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
625 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 624 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
626 }; | 625 }; |
627 | 626 |
628 } } // namespace v8::internal | 627 } } // namespace v8::internal |
629 | 628 |
630 #endif // V8_CONTEXTS_H_ | 629 #endif // V8_CONTEXTS_H_ |
OLD | NEW |