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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 ContextLookupFlags flags, | 544 ContextLookupFlags flags, |
545 int* index, | 545 int* index, |
546 PropertyAttributes* attributes, | 546 PropertyAttributes* attributes, |
547 BindingFlags* binding_flags); | 547 BindingFlags* binding_flags); |
548 | 548 |
549 // Code generation support. | 549 // Code generation support. |
550 static int SlotOffset(int index) { | 550 static int SlotOffset(int index) { |
551 return kHeaderSize + index * kPointerSize - kHeapObjectTag; | 551 return kHeaderSize + index * kPointerSize - kHeapObjectTag; |
552 } | 552 } |
553 | 553 |
554 static int FunctionMapIndex(StrictMode strict_mode, bool is_generator) { | 554 static int FunctionMapIndex(StrictMode strict_mode, FunctionKind kind) { |
555 return is_generator | 555 if (IsGeneratorFunction(kind)) { |
556 ? (strict_mode == SLOPPY | 556 return strict_mode == SLOPPY ? SLOPPY_GENERATOR_FUNCTION_MAP_INDEX |
557 ? SLOPPY_GENERATOR_FUNCTION_MAP_INDEX | 557 : STRICT_GENERATOR_FUNCTION_MAP_INDEX; |
558 : STRICT_GENERATOR_FUNCTION_MAP_INDEX) | 558 } |
559 : (strict_mode == SLOPPY | 559 |
560 ? SLOPPY_FUNCTION_MAP_INDEX | 560 if (IsConciseMethod(kind)) { |
561 : STRICT_FUNCTION_MAP_INDEX); | 561 return strict_mode == SLOPPY |
| 562 ? SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX |
| 563 : STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; |
| 564 } |
| 565 |
| 566 return strict_mode == SLOPPY ? SLOPPY_FUNCTION_MAP_INDEX |
| 567 : STRICT_FUNCTION_MAP_INDEX; |
562 } | 568 } |
563 | 569 |
564 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; | 570 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; |
565 | 571 |
566 // GC support. | 572 // GC support. |
567 typedef FixedBodyDescriptor< | 573 typedef FixedBodyDescriptor< |
568 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; | 574 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; |
569 | 575 |
570 typedef FixedBodyDescriptor< | 576 typedef FixedBodyDescriptor< |
571 kHeaderSize, | 577 kHeaderSize, |
(...skipping 10 matching lines...) Expand all Loading... |
582 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 588 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
583 #endif | 589 #endif |
584 | 590 |
585 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 591 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
586 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 592 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
587 }; | 593 }; |
588 | 594 |
589 } } // namespace v8::internal | 595 } } // namespace v8::internal |
590 | 596 |
591 #endif // V8_CONTEXTS_H_ | 597 #endif // V8_CONTEXTS_H_ |
OLD | NEW |