Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: src/code-stubs.cc

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: Changes from review Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 void FastNewClosureStub::GenerateAssembly( 2585 void FastNewClosureStub::GenerateAssembly(
2586 compiler::CodeAssemblerState* state) const { 2586 compiler::CodeAssemblerState* state) const {
2587 typedef compiler::Node Node; 2587 typedef compiler::Node Node;
2588 CodeStubAssembler assembler(state); 2588 CodeStubAssembler assembler(state);
2589 Node* shared = assembler.Parameter(Descriptor::kSharedFunctionInfo); 2589 Node* shared = assembler.Parameter(Descriptor::kSharedFunctionInfo);
2590 Node* context = assembler.Parameter(Descriptor::kContext); 2590 Node* context = assembler.Parameter(Descriptor::kContext);
2591 assembler.Return(Generate(&assembler, shared, context)); 2591 assembler.Return(Generate(&assembler, shared, context));
2592 } 2592 }
2593 2593
2594 // static 2594 // static
2595 int FastNewFunctionContextStub::MaximumSlots() {
2596 return FLAG_test_small_max_function_context_stub_size ? kSmallMaximumSlots
2597 : kMaximumSlots;
2598 }
2599
2600 // static
2595 compiler::Node* FastNewFunctionContextStub::Generate( 2601 compiler::Node* FastNewFunctionContextStub::Generate(
2596 CodeStubAssembler* assembler, compiler::Node* function, 2602 CodeStubAssembler* assembler, compiler::Node* function,
2597 compiler::Node* slots, compiler::Node* context) { 2603 compiler::Node* slots, compiler::Node* context, ScopeType scope_type) {
2598 typedef compiler::Node Node; 2604 typedef compiler::Node Node;
2599 2605
2600 slots = assembler->ChangeUint32ToWord(slots); 2606 slots = assembler->ChangeUint32ToWord(slots);
2601 2607
2602 // TODO(ishell): Use CSA::OptimalParameterMode() here. 2608 // TODO(ishell): Use CSA::OptimalParameterMode() here.
2603 CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS; 2609 CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS;
2604 Node* min_context_slots = 2610 Node* min_context_slots =
2605 assembler->IntPtrConstant(Context::MIN_CONTEXT_SLOTS); 2611 assembler->IntPtrConstant(Context::MIN_CONTEXT_SLOTS);
2606 Node* length = assembler->IntPtrAdd(slots, min_context_slots); 2612 Node* length = assembler->IntPtrAdd(slots, min_context_slots);
2607 Node* size = 2613 Node* size =
2608 assembler->GetFixedArrayAllocationSize(length, FAST_ELEMENTS, mode); 2614 assembler->GetFixedArrayAllocationSize(length, FAST_ELEMENTS, mode);
2609 2615
2610 // Create a new closure from the given function info in new space 2616 // Create a new closure from the given function info in new space
2611 Node* function_context = assembler->Allocate(size); 2617 Node* function_context = assembler->Allocate(size);
2612 2618
2613 assembler->StoreMapNoWriteBarrier(function_context, 2619 Heap::RootListIndex context_type;
2614 Heap::kFunctionContextMapRootIndex); 2620 switch (scope_type) {
2621 case EVAL_SCOPE:
2622 context_type = Heap::kEvalContextMapRootIndex;
2623 break;
2624 case FUNCTION_SCOPE:
2625 context_type = Heap::kFunctionContextMapRootIndex;
2626 break;
2627 default:
2628 UNREACHABLE();
2629 }
2630 assembler->StoreMapNoWriteBarrier(function_context, context_type);
2615 assembler->StoreObjectFieldNoWriteBarrier( 2631 assembler->StoreObjectFieldNoWriteBarrier(
2616 function_context, Context::kLengthOffset, assembler->SmiTag(length)); 2632 function_context, Context::kLengthOffset, assembler->SmiTag(length));
2617 2633
2618 // Set up the fixed slots. 2634 // Set up the fixed slots.
2619 assembler->StoreFixedArrayElement(function_context, Context::CLOSURE_INDEX, 2635 assembler->StoreFixedArrayElement(function_context, Context::CLOSURE_INDEX,
2620 function, SKIP_WRITE_BARRIER); 2636 function, SKIP_WRITE_BARRIER);
2621 assembler->StoreFixedArrayElement(function_context, Context::PREVIOUS_INDEX, 2637 assembler->StoreFixedArrayElement(function_context, Context::PREVIOUS_INDEX,
2622 context, SKIP_WRITE_BARRIER); 2638 context, SKIP_WRITE_BARRIER);
2623 assembler->StoreFixedArrayElement(function_context, Context::EXTENSION_INDEX, 2639 assembler->StoreFixedArrayElement(function_context, Context::EXTENSION_INDEX,
2624 assembler->TheHoleConstant(), 2640 assembler->TheHoleConstant(),
(...skipping 19 matching lines...) Expand all
2644 } 2660 }
2645 2661
2646 void FastNewFunctionContextStub::GenerateAssembly( 2662 void FastNewFunctionContextStub::GenerateAssembly(
2647 compiler::CodeAssemblerState* state) const { 2663 compiler::CodeAssemblerState* state) const {
2648 typedef compiler::Node Node; 2664 typedef compiler::Node Node;
2649 CodeStubAssembler assembler(state); 2665 CodeStubAssembler assembler(state);
2650 Node* function = assembler.Parameter(Descriptor::kFunction); 2666 Node* function = assembler.Parameter(Descriptor::kFunction);
2651 Node* slots = assembler.Parameter(Descriptor::kSlots); 2667 Node* slots = assembler.Parameter(Descriptor::kSlots);
2652 Node* context = assembler.Parameter(Descriptor::kContext); 2668 Node* context = assembler.Parameter(Descriptor::kContext);
2653 2669
2654 assembler.Return(Generate(&assembler, function, slots, context)); 2670 assembler.Return(
2671 Generate(&assembler, function, slots, context, scope_type()));
2655 } 2672 }
2656 2673
2657 // static 2674 // static
2658 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, 2675 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler,
2659 compiler::Node* closure, 2676 compiler::Node* closure,
2660 compiler::Node* literal_index, 2677 compiler::Node* literal_index,
2661 compiler::Node* pattern, 2678 compiler::Node* pattern,
2662 compiler::Node* flags, 2679 compiler::Node* flags,
2663 compiler::Node* context) { 2680 compiler::Node* context) {
2664 typedef CodeStubAssembler::Label Label; 2681 typedef CodeStubAssembler::Label Label;
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
3206 } 3223 }
3207 3224
3208 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 3225 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
3209 : PlatformCodeStub(isolate) {} 3226 : PlatformCodeStub(isolate) {}
3210 3227
3211 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) 3228 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate)
3212 : PlatformCodeStub(isolate) {} 3229 : PlatformCodeStub(isolate) {}
3213 3230
3214 } // namespace internal 3231 } // namespace internal
3215 } // namespace v8 3232 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698