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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 int* index, | 519 int* index, |
520 PropertyAttributes* attributes, | 520 PropertyAttributes* attributes, |
521 BindingFlags* binding_flags); | 521 BindingFlags* binding_flags); |
522 | 522 |
523 // Code generation support. | 523 // Code generation support. |
524 static int SlotOffset(int index) { | 524 static int SlotOffset(int index) { |
525 return kHeaderSize + index * kPointerSize - kHeapObjectTag; | 525 return kHeaderSize + index * kPointerSize - kHeapObjectTag; |
526 } | 526 } |
527 | 527 |
528 static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) { | 528 static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) { |
| 529 // Note: Must be kept in sync with FastNewClosureStub::Generate. |
529 if (IsGeneratorFunction(kind)) { | 530 if (IsGeneratorFunction(kind)) { |
530 return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX | 531 return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX |
531 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; | 532 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; |
532 } | 533 } |
533 | 534 |
534 if (IsAsyncFunction(kind)) { | 535 if (IsAsyncFunction(kind)) { |
535 return is_strict(language_mode) ? STRICT_ASYNC_FUNCTION_MAP_INDEX | 536 return is_strict(language_mode) ? STRICT_ASYNC_FUNCTION_MAP_INDEX |
536 : SLOPPY_ASYNC_FUNCTION_MAP_INDEX; | 537 : SLOPPY_ASYNC_FUNCTION_MAP_INDEX; |
537 } | 538 } |
538 | 539 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 #endif | 576 #endif |
576 | 577 |
577 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 578 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
578 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 579 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
579 }; | 580 }; |
580 | 581 |
581 } // namespace internal | 582 } // namespace internal |
582 } // namespace v8 | 583 } // namespace v8 |
583 | 584 |
584 #endif // V8_CONTEXTS_H_ | 585 #endif // V8_CONTEXTS_H_ |
OLD | NEW |