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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2223523002: [Interpreter] Avoid dereferencing handles on BytecodeGenerator for AST operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_const_array
Patch Set: Created 4 years, 4 months 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/bytecode-flags.h" 10 #include "src/interpreter/bytecode-flags.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 NativeFunctionLiteral* expr = literal.first; 657 NativeFunctionLiteral* expr = literal.first;
658 Handle<SharedFunctionInfo> shared_info = 658 Handle<SharedFunctionInfo> shared_info =
659 Compiler::GetSharedFunctionInfoForNative(expr->extension(), 659 Compiler::GetSharedFunctionInfoForNative(expr->extension(),
660 expr->name()); 660 expr->name());
661 if (shared_info.is_null()) return SetStackOverflow(); 661 if (shared_info.is_null()) return SetStackOverflow();
662 builder()->InsertConstantPoolEntryAt(literal.second, shared_info); 662 builder()->InsertConstantPoolEntryAt(literal.second, shared_info);
663 } 663 }
664 } 664 }
665 665
666 void BytecodeGenerator::GenerateBytecode() { 666 void BytecodeGenerator::GenerateBytecode() {
667 DisallowHeapAllocation no_allocation;
668 DisallowHandleAllocation no_handles;
669 DisallowHandleDereference no_deref;
670
667 // Initialize the incoming context. 671 // Initialize the incoming context.
668 ContextScope incoming_context(this, scope(), false); 672 ContextScope incoming_context(this, scope(), false);
669 673
670 // Initialize control scope. 674 // Initialize control scope.
671 ControlScopeForTopLevel control(this); 675 ControlScopeForTopLevel control(this);
672 676
673 RegisterAllocationScope register_scope(this); 677 RegisterAllocationScope register_scope(this);
674 678
675 if (IsResumableFunction(info()->literal()->kind())) { 679 if (IsResumableFunction(info()->literal()->kind())) {
676 generator_state_ = register_allocator()->NewRegister(); 680 generator_state_ = register_allocator()->NewRegister();
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 loop_builder.EndLoop(); 1155 loop_builder.EndLoop();
1152 } 1156 }
1153 1157
1154 void BytecodeGenerator::VisitForInAssignment(Expression* expr, 1158 void BytecodeGenerator::VisitForInAssignment(Expression* expr,
1155 FeedbackVectorSlot slot) { 1159 FeedbackVectorSlot slot) {
1156 DCHECK(expr->IsValidReferenceExpression()); 1160 DCHECK(expr->IsValidReferenceExpression());
1157 1161
1158 // Evaluate assignment starting with the value to be stored in the 1162 // Evaluate assignment starting with the value to be stored in the
1159 // accumulator. 1163 // accumulator.
1160 Property* property = expr->AsProperty(); 1164 Property* property = expr->AsProperty();
1161 LhsKind assign_type = Property::GetAssignType(property); 1165 LhsKind assign_type = Property::GetAssignType(
1166 property, HandleDereferenceMode::kHandleDereferenceDisallowed);
1162 switch (assign_type) { 1167 switch (assign_type) {
1163 case VARIABLE: { 1168 case VARIABLE: {
1164 Variable* variable = expr->AsVariableProxy()->var(); 1169 Variable* variable = expr->AsVariableProxy()->var();
1165 VisitVariableAssignment(variable, Token::ASSIGN, slot); 1170 VisitVariableAssignment(variable, Token::ASSIGN, slot);
1166 break; 1171 break;
1167 } 1172 }
1168 case NAMED_PROPERTY: { 1173 case NAMED_PROPERTY: {
1169 RegisterAllocationScope register_scope(this); 1174 RegisterAllocationScope register_scope(this);
1170 Register value = register_allocator()->NewRegister(); 1175 Register value = register_allocator()->NewRegister();
1171 builder()->StoreAccumulatorInRegister(value); 1176 builder()->StoreAccumulatorInRegister(value);
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 Literal* literal_key = property->key()->AsLiteral(); 1635 Literal* literal_key = property->key()->AsLiteral();
1631 switch (property->kind()) { 1636 switch (property->kind()) {
1632 case ObjectLiteral::Property::CONSTANT: 1637 case ObjectLiteral::Property::CONSTANT:
1633 UNREACHABLE(); 1638 UNREACHABLE();
1634 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1639 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1635 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); 1640 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value()));
1636 // Fall through. 1641 // Fall through.
1637 case ObjectLiteral::Property::COMPUTED: { 1642 case ObjectLiteral::Property::COMPUTED: {
1638 // It is safe to use [[Put]] here because the boilerplate already 1643 // It is safe to use [[Put]] here because the boilerplate already
1639 // contains computed properties with an uninitialized value. 1644 // contains computed properties with an uninitialized value.
1645
1646 // TODO(5203): Remove this temporary exception.
1647 AllowHandleDereference allow_deref;
1648
1640 if (literal_key->value()->IsInternalizedString()) { 1649 if (literal_key->value()->IsInternalizedString()) {
1641 if (property->emit_store()) { 1650 if (property->emit_store()) {
1642 VisitForAccumulatorValue(property->value()); 1651 VisitForAccumulatorValue(property->value());
1643 if (FunctionLiteral::NeedsHomeObject(property->value())) { 1652 if (FunctionLiteral::NeedsHomeObject(property->value())) {
1644 RegisterAllocationScope register_scope(this); 1653 RegisterAllocationScope register_scope(this);
1645 Register value = register_allocator()->NewRegister(); 1654 Register value = register_allocator()->NewRegister();
1646 builder()->StoreAccumulatorInRegister(value); 1655 builder()->StoreAccumulatorInRegister(value);
1647 builder()->StoreNamedProperty( 1656 builder()->StoreNamedProperty(
1648 literal, literal_key->AsPropertyName(), 1657 literal, literal_key->AsPropertyName(),
1649 feedback_index(property->GetSlot(0)), language_mode()); 1658 feedback_index(property->GetSlot(0)), language_mode());
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 } 2147 }
2139 } 2148 }
2140 2149
2141 void BytecodeGenerator::VisitAssignment(Assignment* expr) { 2150 void BytecodeGenerator::VisitAssignment(Assignment* expr) {
2142 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); 2151 DCHECK(expr->target()->IsValidReferenceExpressionOrThis());
2143 Register object, key, home_object, value; 2152 Register object, key, home_object, value;
2144 Handle<String> name; 2153 Handle<String> name;
2145 2154
2146 // Left-hand side can only be a property, a global or a variable slot. 2155 // Left-hand side can only be a property, a global or a variable slot.
2147 Property* property = expr->target()->AsProperty(); 2156 Property* property = expr->target()->AsProperty();
2148 LhsKind assign_type = Property::GetAssignType(property); 2157 LhsKind assign_type = Property::GetAssignType(
2158 property, HandleDereferenceMode::kHandleDereferenceDisallowed);
2149 2159
2150 // Evaluate LHS expression. 2160 // Evaluate LHS expression.
2151 switch (assign_type) { 2161 switch (assign_type) {
2152 case VARIABLE: 2162 case VARIABLE:
2153 // Nothing to do to evaluate variable assignment LHS. 2163 // Nothing to do to evaluate variable assignment LHS.
2154 break; 2164 break;
2155 case NAMED_PROPERTY: { 2165 case NAMED_PROPERTY: {
2156 object = VisitForRegisterValue(property->obj()); 2166 object = VisitForRegisterValue(property->obj());
2157 name = property->key()->AsLiteral()->AsPropertyName(); 2167 name = property->key()->AsLiteral()->AsPropertyName();
2158 break; 2168 break;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 builder()->SetExpressionPosition(expr); 2375 builder()->SetExpressionPosition(expr);
2366 builder()->Throw(); 2376 builder()->Throw();
2367 // Throw statements are modeled as expressions instead of statements. These 2377 // Throw statements are modeled as expressions instead of statements. These
2368 // are converted from assignment statements in Rewriter::ReWrite pass. An 2378 // are converted from assignment statements in Rewriter::ReWrite pass. An
2369 // assignment statement expects a value in the accumulator. This is a hack to 2379 // assignment statement expects a value in the accumulator. This is a hack to
2370 // avoid DCHECK fails assert accumulator has been set. 2380 // avoid DCHECK fails assert accumulator has been set.
2371 execution_result()->SetResultInAccumulator(); 2381 execution_result()->SetResultInAccumulator();
2372 } 2382 }
2373 2383
2374 void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) { 2384 void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) {
2375 LhsKind property_kind = Property::GetAssignType(expr); 2385 LhsKind property_kind = Property::GetAssignType(
2386 expr, HandleDereferenceMode::kHandleDereferenceDisallowed);
2376 FeedbackVectorSlot slot = expr->PropertyFeedbackSlot(); 2387 FeedbackVectorSlot slot = expr->PropertyFeedbackSlot();
2377 builder()->SetExpressionPosition(expr); 2388 builder()->SetExpressionPosition(expr);
2378 switch (property_kind) { 2389 switch (property_kind) {
2379 case VARIABLE: 2390 case VARIABLE:
2380 UNREACHABLE(); 2391 UNREACHABLE();
2381 case NAMED_PROPERTY: { 2392 case NAMED_PROPERTY: {
2382 builder()->LoadNamedProperty(obj, 2393 builder()->LoadNamedProperty(obj,
2383 expr->key()->AsLiteral()->AsPropertyName(), 2394 expr->key()->AsLiteral()->AsPropertyName(),
2384 feedback_index(slot)); 2395 feedback_index(slot));
2385 break; 2396 break;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 VisitForRegisterValue(super_property->home_object(), home_object); 2454 VisitForRegisterValue(super_property->home_object(), home_object);
2444 VisitForRegisterValue(property->key(), key); 2455 VisitForRegisterValue(property->key(), key);
2445 BuildKeyedSuperPropertyLoad(receiver, home_object, key); 2456 BuildKeyedSuperPropertyLoad(receiver, home_object, key);
2446 2457
2447 if (opt_receiver_out.is_valid()) { 2458 if (opt_receiver_out.is_valid()) {
2448 builder()->MoveRegister(receiver, opt_receiver_out); 2459 builder()->MoveRegister(receiver, opt_receiver_out);
2449 } 2460 }
2450 } 2461 }
2451 2462
2452 void BytecodeGenerator::VisitProperty(Property* expr) { 2463 void BytecodeGenerator::VisitProperty(Property* expr) {
2453 LhsKind property_kind = Property::GetAssignType(expr); 2464 LhsKind property_kind = Property::GetAssignType(
2465 expr, HandleDereferenceMode::kHandleDereferenceDisallowed);
2454 if (property_kind != NAMED_SUPER_PROPERTY && 2466 if (property_kind != NAMED_SUPER_PROPERTY &&
2455 property_kind != KEYED_SUPER_PROPERTY) { 2467 property_kind != KEYED_SUPER_PROPERTY) {
2456 Register obj = VisitForRegisterValue(expr->obj()); 2468 Register obj = VisitForRegisterValue(expr->obj());
2457 VisitPropertyLoad(obj, expr); 2469 VisitPropertyLoad(obj, expr);
2458 } else { 2470 } else {
2459 VisitPropertyLoad(Register::invalid_value(), expr); 2471 VisitPropertyLoad(Register::invalid_value(), expr);
2460 } 2472 }
2461 } 2473 }
2462 2474
2463 Register BytecodeGenerator::VisitArguments(ZoneList<Expression*>* args) { 2475 Register BytecodeGenerator::VisitArguments(ZoneList<Expression*>* args) {
(...skipping 23 matching lines...) Expand all
2487 Register ith_arg = register_allocator()->NextConsecutiveRegister(); 2499 Register ith_arg = register_allocator()->NextConsecutiveRegister();
2488 VisitForAccumulatorValue(args->at(i)); 2500 VisitForAccumulatorValue(args->at(i));
2489 builder()->StoreAccumulatorInRegister(ith_arg); 2501 builder()->StoreAccumulatorInRegister(ith_arg);
2490 DCHECK(ith_arg.index() - i == first_arg.index()); 2502 DCHECK(ith_arg.index() - i == first_arg.index());
2491 } 2503 }
2492 return first_arg; 2504 return first_arg;
2493 } 2505 }
2494 2506
2495 void BytecodeGenerator::VisitCall(Call* expr) { 2507 void BytecodeGenerator::VisitCall(Call* expr) {
2496 Expression* callee_expr = expr->expression(); 2508 Expression* callee_expr = expr->expression();
2497 Call::CallType call_type = expr->GetCallType(isolate()); 2509 Call::CallType call_type = expr->GetCallType(
2510 isolate(), HandleDereferenceMode::kHandleDereferenceDisallowed);
2498 2511
2499 if (call_type == Call::SUPER_CALL) { 2512 if (call_type == Call::SUPER_CALL) {
2500 return VisitCallSuper(expr); 2513 return VisitCallSuper(expr);
2501 } 2514 }
2502 2515
2503 // Prepare the callee and the receiver to the function call. This depends on 2516 // Prepare the callee and the receiver to the function call. This depends on
2504 // the semantics of the underlying call type. 2517 // the semantics of the underlying call type.
2505 2518
2506 // The receiver and arguments need to be allocated consecutively for 2519 // The receiver and arguments need to be allocated consecutively for
2507 // Call(). We allocate the callee and receiver consecutively for calls to 2520 // Call(). We allocate the callee and receiver consecutively for calls to
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 // and strict modes. 2765 // and strict modes.
2753 Property* property = expr->expression()->AsProperty(); 2766 Property* property = expr->expression()->AsProperty();
2754 Register object = VisitForRegisterValue(property->obj()); 2767 Register object = VisitForRegisterValue(property->obj());
2755 VisitForAccumulatorValue(property->key()); 2768 VisitForAccumulatorValue(property->key());
2756 builder()->Delete(object, language_mode()); 2769 builder()->Delete(object, language_mode());
2757 } else if (expr->expression()->IsVariableProxy()) { 2770 } else if (expr->expression()->IsVariableProxy()) {
2758 // Delete of an unqualified identifier is allowed in sloppy mode but is 2771 // Delete of an unqualified identifier is allowed in sloppy mode but is
2759 // not allowed in strict mode. Deleting 'this' is allowed in both modes. 2772 // not allowed in strict mode. Deleting 'this' is allowed in both modes.
2760 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 2773 VariableProxy* proxy = expr->expression()->AsVariableProxy();
2761 Variable* variable = proxy->var(); 2774 Variable* variable = proxy->var();
2762 DCHECK(is_sloppy(language_mode()) || variable->HasThisName(isolate())); 2775 DCHECK(is_sloppy(language_mode()) ||
2776 variable->HasThisName(
2777 isolate(), HandleDereferenceMode::kHandleDereferenceDisallowed));
2763 switch (variable->location()) { 2778 switch (variable->location()) {
2764 case VariableLocation::GLOBAL: 2779 case VariableLocation::GLOBAL:
2765 case VariableLocation::UNALLOCATED: { 2780 case VariableLocation::UNALLOCATED: {
2766 // Global var, let, const or variables not explicitly declared. 2781 // Global var, let, const or variables not explicitly declared.
2767 Register native_context = register_allocator()->NewRegister(); 2782 Register native_context = register_allocator()->NewRegister();
2768 Register global_object = register_allocator()->NewRegister(); 2783 Register global_object = register_allocator()->NewRegister();
2769 builder() 2784 builder()
2770 ->LoadContextSlot(execution_context()->reg(), 2785 ->LoadContextSlot(execution_context()->reg(),
2771 Context::NATIVE_CONTEXT_INDEX) 2786 Context::NATIVE_CONTEXT_INDEX)
2772 .StoreAccumulatorInRegister(native_context) 2787 .StoreAccumulatorInRegister(native_context)
2773 .LoadContextSlot(native_context, Context::EXTENSION_INDEX) 2788 .LoadContextSlot(native_context, Context::EXTENSION_INDEX)
2774 .StoreAccumulatorInRegister(global_object) 2789 .StoreAccumulatorInRegister(global_object)
2775 .LoadLiteral(variable->name()) 2790 .LoadLiteral(variable->name())
2776 .Delete(global_object, language_mode()); 2791 .Delete(global_object, language_mode());
2777 break; 2792 break;
2778 } 2793 }
2779 case VariableLocation::PARAMETER: 2794 case VariableLocation::PARAMETER:
2780 case VariableLocation::LOCAL: 2795 case VariableLocation::LOCAL:
2781 case VariableLocation::CONTEXT: { 2796 case VariableLocation::CONTEXT: {
2782 // Deleting local var/let/const, context variables, and arguments 2797 // Deleting local var/let/const, context variables, and arguments
2783 // does not have any effect. 2798 // does not have any effect.
2784 if (variable->HasThisName(isolate())) { 2799 if (variable->HasThisName(
2800 isolate(),
2801 HandleDereferenceMode::kHandleDereferenceDisallowed)) {
2785 builder()->LoadTrue(); 2802 builder()->LoadTrue();
2786 } else { 2803 } else {
2787 builder()->LoadFalse(); 2804 builder()->LoadFalse();
2788 } 2805 }
2789 break; 2806 break;
2790 } 2807 }
2791 case VariableLocation::LOOKUP: { 2808 case VariableLocation::LOOKUP: {
2792 Register name_reg = register_allocator()->NewRegister(); 2809 Register name_reg = register_allocator()->NewRegister();
2793 builder() 2810 builder()
2794 ->LoadLiteral(variable->name()) 2811 ->LoadLiteral(variable->name())
(...skipping 10 matching lines...) Expand all
2805 builder()->LoadTrue(); 2822 builder()->LoadTrue();
2806 } 2823 }
2807 execution_result()->SetResultInAccumulator(); 2824 execution_result()->SetResultInAccumulator();
2808 } 2825 }
2809 2826
2810 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { 2827 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
2811 DCHECK(expr->expression()->IsValidReferenceExpressionOrThis()); 2828 DCHECK(expr->expression()->IsValidReferenceExpressionOrThis());
2812 2829
2813 // Left-hand side can only be a property, a global or a variable slot. 2830 // Left-hand side can only be a property, a global or a variable slot.
2814 Property* property = expr->expression()->AsProperty(); 2831 Property* property = expr->expression()->AsProperty();
2815 LhsKind assign_type = Property::GetAssignType(property); 2832 LhsKind assign_type = Property::GetAssignType(
2833 property, HandleDereferenceMode::kHandleDereferenceDisallowed);
2816 2834
2817 bool is_postfix = expr->is_postfix() && !execution_result()->IsEffect(); 2835 bool is_postfix = expr->is_postfix() && !execution_result()->IsEffect();
2818 2836
2819 // Evaluate LHS expression and get old value. 2837 // Evaluate LHS expression and get old value.
2820 Register object, home_object, key, old_value, value; 2838 Register object, home_object, key, old_value, value;
2821 Handle<String> name; 2839 Handle<String> name;
2822 switch (assign_type) { 2840 switch (assign_type) {
2823 case VARIABLE: { 2841 case VARIABLE: {
2824 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 2842 VariableProxy* proxy = expr->expression()->AsVariableProxy();
2825 VisitVariableLoadForAccumulatorValue(proxy->var(), 2843 VisitVariableLoadForAccumulatorValue(proxy->var(),
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 void BytecodeGenerator::VisitRewritableExpression(RewritableExpression* expr) { 3044 void BytecodeGenerator::VisitRewritableExpression(RewritableExpression* expr) {
3027 Visit(expr->expression()); 3045 Visit(expr->expression());
3028 } 3046 }
3029 3047
3030 void BytecodeGenerator::VisitNewLocalFunctionContext() { 3048 void BytecodeGenerator::VisitNewLocalFunctionContext() {
3031 AccumulatorResultScope accumulator_execution_result(this); 3049 AccumulatorResultScope accumulator_execution_result(this);
3032 Scope* scope = this->scope(); 3050 Scope* scope = this->scope();
3033 3051
3034 // Allocate a new local context. 3052 // Allocate a new local context.
3035 if (scope->is_script_scope()) { 3053 if (scope->is_script_scope()) {
3054 // TODO(5203): Remove this temporary exception.
3055 AllowHeapAllocation allow_allocation;
3056 AllowHandleAllocation allow_handles;
3057 AllowHandleDereference allow_deref;
3058
3036 RegisterAllocationScope register_scope(this); 3059 RegisterAllocationScope register_scope(this);
3037 Register closure = register_allocator()->NewRegister(); 3060 Register closure = register_allocator()->NewRegister();
3038 Register scope_info = register_allocator()->NewRegister(); 3061 Register scope_info = register_allocator()->NewRegister();
3039 DCHECK(Register::AreContiguous(closure, scope_info)); 3062 DCHECK(Register::AreContiguous(closure, scope_info));
3040 builder() 3063 builder()
3041 ->LoadAccumulatorWithRegister(Register::function_closure()) 3064 ->LoadAccumulatorWithRegister(Register::function_closure())
3042 .StoreAccumulatorInRegister(closure) 3065 .StoreAccumulatorInRegister(closure)
3043 .LoadLiteral(scope->GetScopeInfo(isolate())) 3066 .LoadLiteral(scope->GetScopeInfo(isolate()))
3044 .StoreAccumulatorInRegister(scope_info) 3067 .StoreAccumulatorInRegister(scope_info)
3045 .CallRuntime(Runtime::kNewScriptContext, closure, 2); 3068 .CallRuntime(Runtime::kNewScriptContext, closure, 2);
(...skipping 26 matching lines...) Expand all
3072 // index -1 but is parameter index 0 in BytecodeArrayBuilder). 3095 // index -1 but is parameter index 0 in BytecodeArrayBuilder).
3073 Register parameter(builder()->Parameter(i + 1)); 3096 Register parameter(builder()->Parameter(i + 1));
3074 // Context variable (at bottom of the context chain). 3097 // Context variable (at bottom of the context chain).
3075 DCHECK_EQ(0, scope->ContextChainLength(variable->scope())); 3098 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
3076 builder()->LoadAccumulatorWithRegister(parameter) 3099 builder()->LoadAccumulatorWithRegister(parameter)
3077 .StoreContextSlot(execution_context()->reg(), variable->index()); 3100 .StoreContextSlot(execution_context()->reg(), variable->index());
3078 } 3101 }
3079 } 3102 }
3080 3103
3081 void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) { 3104 void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) {
3105 // TODO(5203): Remove this temporary exception.
3106 AllowHeapAllocation allow_allocation;
3107 AllowHandleAllocation allow_handles;
3108 AllowHandleDereference allow_deref;
3109
3082 AccumulatorResultScope accumulator_execution_result(this); 3110 AccumulatorResultScope accumulator_execution_result(this);
3083 DCHECK(scope->is_block_scope()); 3111 DCHECK(scope->is_block_scope());
3084 3112
3085 // Allocate a new local block context. 3113 // Allocate a new local block context.
3086 register_allocator()->PrepareForConsecutiveAllocations(2); 3114 register_allocator()->PrepareForConsecutiveAllocations(2);
3087 Register scope_info = register_allocator()->NextConsecutiveRegister(); 3115 Register scope_info = register_allocator()->NextConsecutiveRegister();
3088 Register closure = register_allocator()->NextConsecutiveRegister(); 3116 Register closure = register_allocator()->NextConsecutiveRegister();
3089 3117
3090 builder() 3118 builder()
3091 ->LoadLiteral(scope->GetScopeInfo(isolate())) 3119 ->LoadLiteral(scope->GetScopeInfo(isolate()))
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 return execution_context()->scope()->language_mode(); 3299 return execution_context()->scope()->language_mode();
3272 } 3300 }
3273 3301
3274 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3302 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3275 return TypeFeedbackVector::GetIndex(slot); 3303 return TypeFeedbackVector::GetIndex(slot);
3276 } 3304 }
3277 3305
3278 } // namespace interpreter 3306 } // namespace interpreter
3279 } // namespace internal 3307 } // namespace internal
3280 } // namespace v8 3308 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698