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

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

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: Clean up test 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
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 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 void FastNewClosureStub::GenerateAssembly( 2596 void FastNewClosureStub::GenerateAssembly(
2597 compiler::CodeAssemblerState* state) const { 2597 compiler::CodeAssemblerState* state) const {
2598 typedef compiler::Node Node; 2598 typedef compiler::Node Node;
2599 CodeStubAssembler assembler(state); 2599 CodeStubAssembler assembler(state);
2600 Node* shared = assembler.Parameter(Descriptor::kSharedFunctionInfo); 2600 Node* shared = assembler.Parameter(Descriptor::kSharedFunctionInfo);
2601 Node* context = assembler.Parameter(Descriptor::kContext); 2601 Node* context = assembler.Parameter(Descriptor::kContext);
2602 assembler.Return(Generate(&assembler, shared, context)); 2602 assembler.Return(Generate(&assembler, shared, context));
2603 } 2603 }
2604 2604
2605 // static 2605 // static
2606 int FastNewFunctionContextStub::MaximumSlots() {
2607 return FLAG_test_small_max_function_context_stub_size ? kSmallMaximumSlots
2608 : kMaximumSlots;
2609 }
2610
2611 // static
2606 compiler::Node* FastNewFunctionContextStub::Generate( 2612 compiler::Node* FastNewFunctionContextStub::Generate(
2607 CodeStubAssembler* assembler, compiler::Node* function, 2613 CodeStubAssembler* assembler, compiler::Node* function,
2608 compiler::Node* slots, compiler::Node* context) { 2614 compiler::Node* slots, compiler::Node* context, ScopeType scope_type) {
2609 typedef compiler::Node Node; 2615 typedef compiler::Node Node;
2610 2616
2611 slots = assembler->ChangeUint32ToWord(slots); 2617 slots = assembler->ChangeUint32ToWord(slots);
2612 2618
2613 // TODO(ishell): Use CSA::OptimalParameterMode() here. 2619 // TODO(ishell): Use CSA::OptimalParameterMode() here.
2614 CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS; 2620 CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS;
2615 Node* min_context_slots = 2621 Node* min_context_slots =
2616 assembler->IntPtrConstant(Context::MIN_CONTEXT_SLOTS); 2622 assembler->IntPtrConstant(Context::MIN_CONTEXT_SLOTS);
2617 Node* length = assembler->IntPtrAdd(slots, min_context_slots); 2623 Node* length = assembler->IntPtrAdd(slots, min_context_slots);
2618 Node* size = 2624 Node* size =
2619 assembler->GetFixedArrayAllocationSize(length, FAST_ELEMENTS, mode); 2625 assembler->GetFixedArrayAllocationSize(length, FAST_ELEMENTS, mode);
2620 2626
2621 // Create a new closure from the given function info in new space 2627 // Create a new closure from the given function info in new space
2622 Node* function_context = assembler->Allocate(size); 2628 Node* function_context = assembler->Allocate(size);
2623 2629
2624 assembler->StoreMapNoWriteBarrier(function_context, 2630 Heap::RootListIndex context_type;
2625 Heap::kFunctionContextMapRootIndex); 2631 switch (scope_type) {
2632 case EVAL_SCOPE:
2633 context_type = Heap::kEvalContextMapRootIndex;
2634 break;
2635 case FUNCTION_SCOPE:
2636 context_type = Heap::kFunctionContextMapRootIndex;
2637 break;
2638 default:
2639 UNREACHABLE();
2640 }
2641 assembler->StoreMapNoWriteBarrier(function_context, context_type);
2626 assembler->StoreObjectFieldNoWriteBarrier( 2642 assembler->StoreObjectFieldNoWriteBarrier(
2627 function_context, Context::kLengthOffset, assembler->SmiTag(length)); 2643 function_context, Context::kLengthOffset, assembler->SmiTag(length));
2628 2644
2629 // Set up the fixed slots. 2645 // Set up the fixed slots.
2630 assembler->StoreFixedArrayElement(function_context, Context::CLOSURE_INDEX, 2646 assembler->StoreFixedArrayElement(function_context, Context::CLOSURE_INDEX,
2631 function, SKIP_WRITE_BARRIER); 2647 function, SKIP_WRITE_BARRIER);
2632 assembler->StoreFixedArrayElement(function_context, Context::PREVIOUS_INDEX, 2648 assembler->StoreFixedArrayElement(function_context, Context::PREVIOUS_INDEX,
2633 context, SKIP_WRITE_BARRIER); 2649 context, SKIP_WRITE_BARRIER);
2634 assembler->StoreFixedArrayElement(function_context, Context::EXTENSION_INDEX, 2650 assembler->StoreFixedArrayElement(function_context, Context::EXTENSION_INDEX,
2635 assembler->TheHoleConstant(), 2651 assembler->TheHoleConstant(),
(...skipping 19 matching lines...) Expand all
2655 } 2671 }
2656 2672
2657 void FastNewFunctionContextStub::GenerateAssembly( 2673 void FastNewFunctionContextStub::GenerateAssembly(
2658 compiler::CodeAssemblerState* state) const { 2674 compiler::CodeAssemblerState* state) const {
2659 typedef compiler::Node Node; 2675 typedef compiler::Node Node;
2660 CodeStubAssembler assembler(state); 2676 CodeStubAssembler assembler(state);
2661 Node* function = assembler.Parameter(Descriptor::kFunction); 2677 Node* function = assembler.Parameter(Descriptor::kFunction);
2662 Node* slots = assembler.Parameter(Descriptor::kSlots); 2678 Node* slots = assembler.Parameter(Descriptor::kSlots);
2663 Node* context = assembler.Parameter(Descriptor::kContext); 2679 Node* context = assembler.Parameter(Descriptor::kContext);
2664 2680
2665 assembler.Return(Generate(&assembler, function, slots, context)); 2681 assembler.Return(
2682 Generate(&assembler, function, slots, context, scope_type()));
2666 } 2683 }
2667 2684
2668 // static 2685 // static
2669 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, 2686 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler,
2670 compiler::Node* closure, 2687 compiler::Node* closure,
2671 compiler::Node* literal_index, 2688 compiler::Node* literal_index,
2672 compiler::Node* pattern, 2689 compiler::Node* pattern,
2673 compiler::Node* flags, 2690 compiler::Node* flags,
2674 compiler::Node* context) { 2691 compiler::Node* context) {
2675 typedef CodeStubAssembler::Label Label; 2692 typedef CodeStubAssembler::Label Label;
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 } 3234 }
3218 3235
3219 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 3236 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
3220 : PlatformCodeStub(isolate) {} 3237 : PlatformCodeStub(isolate) {}
3221 3238
3222 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) 3239 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate)
3223 : PlatformCodeStub(isolate) {} 3240 : PlatformCodeStub(isolate) {}
3224 3241
3225 } // namespace internal 3242 } // namespace internal
3226 } // namespace v8 3243 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | src/contexts.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698