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