Chromium Code Reviews| 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 : is_strict(language_mode) || !IsAccessorFunction(kind) |
|
arv (Not doing code reviews)
2015/04/07 16:18:39
I don't understand why accessor functions are spec
caitp (gmail)
2015/04/07 16:29:57
It was to avoid breaking the old behaviour.
But I
arv (Not doing code reviews)
2015/04/07 17:00:11
Accessors are considered Methods in ES6 so they ha
caitp (gmail)
2015/04/07 17:10:36
Oh I see what you're saying. So I guess I was tryi
arv (Not doing code reviews)
2015/04/07 18:22:03
I think sloppy accessors should be treated as slop
| |
| 595 SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; | 595 ? STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX |
| 596 : SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; | |
| 596 } | 597 } |
| 597 | 598 |
| 598 return is_strong(language_mode) ? STRONG_FUNCTION_MAP_INDEX : | 599 return is_strong(language_mode) ? STRONG_FUNCTION_MAP_INDEX : |
| 599 is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX | 600 is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX |
| 600 : SLOPPY_FUNCTION_MAP_INDEX; | 601 : SLOPPY_FUNCTION_MAP_INDEX; |
| 601 } | 602 } |
| 602 | 603 |
| 603 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; | 604 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; |
| 604 | 605 |
| 605 // GC support. | 606 // GC support. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 621 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 622 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
| 622 #endif | 623 #endif |
| 623 | 624 |
| 624 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 625 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
| 625 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 626 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
| 626 }; | 627 }; |
| 627 | 628 |
| 628 } } // namespace v8::internal | 629 } } // namespace v8::internal |
| 629 | 630 |
| 630 #endif // V8_CONTEXTS_H_ | 631 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |