OLD | NEW |
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 3216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3227 VisitFunctionClosureForContext(); | 3227 VisitFunctionClosureForContext(); |
3228 builder()->StoreAccumulatorInRegister(closure).CallRuntime( | 3228 builder()->StoreAccumulatorInRegister(closure).CallRuntime( |
3229 Runtime::kPushWithContext, extension_object, 2); | 3229 Runtime::kPushWithContext, extension_object, 2); |
3230 execution_result()->SetResultInAccumulator(); | 3230 execution_result()->SetResultInAccumulator(); |
3231 } | 3231 } |
3232 | 3232 |
3233 void BytecodeGenerator::VisitNewLocalCatchContext(Variable* variable) { | 3233 void BytecodeGenerator::VisitNewLocalCatchContext(Variable* variable) { |
3234 AccumulatorResultScope accumulator_execution_result(this); | 3234 AccumulatorResultScope accumulator_execution_result(this); |
3235 DCHECK(variable->IsContextSlot()); | 3235 DCHECK(variable->IsContextSlot()); |
3236 | 3236 |
3237 // Allocate a new local block context. | 3237 Register exception = register_allocator()->NewRegister(); |
3238 register_allocator()->PrepareForConsecutiveAllocations(3); | 3238 builder()->StoreAccumulatorInRegister(exception); |
3239 Register name = register_allocator()->NextConsecutiveRegister(); | |
3240 Register exception = register_allocator()->NextConsecutiveRegister(); | |
3241 Register closure = register_allocator()->NextConsecutiveRegister(); | |
3242 | |
3243 builder() | |
3244 ->StoreAccumulatorInRegister(exception) | |
3245 .LoadLiteral(variable->name()) | |
3246 .StoreAccumulatorInRegister(name); | |
3247 VisitFunctionClosureForContext(); | 3239 VisitFunctionClosureForContext(); |
3248 builder()->StoreAccumulatorInRegister(closure).CallRuntime( | 3240 builder()->CreateCatchContext(exception, variable->name()); |
3249 Runtime::kPushCatchContext, name, 3); | |
3250 execution_result()->SetResultInAccumulator(); | 3241 execution_result()->SetResultInAccumulator(); |
3251 } | 3242 } |
3252 | 3243 |
3253 void BytecodeGenerator::VisitObjectLiteralAccessor( | 3244 void BytecodeGenerator::VisitObjectLiteralAccessor( |
3254 Register home_object, ObjectLiteralProperty* property, Register value_out) { | 3245 Register home_object, ObjectLiteralProperty* property, Register value_out) { |
3255 // TODO(rmcilroy): Replace value_out with VisitForRegister(); | 3246 // TODO(rmcilroy): Replace value_out with VisitForRegister(); |
3256 if (property == nullptr) { | 3247 if (property == nullptr) { |
3257 builder()->LoadNull().StoreAccumulatorInRegister(value_out); | 3248 builder()->LoadNull().StoreAccumulatorInRegister(value_out); |
3258 } else { | 3249 } else { |
3259 VisitForAccumulatorValue(property->value()); | 3250 VisitForAccumulatorValue(property->value()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3421 return execution_context()->scope()->language_mode(); | 3412 return execution_context()->scope()->language_mode(); |
3422 } | 3413 } |
3423 | 3414 |
3424 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3415 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3425 return TypeFeedbackVector::GetIndex(slot); | 3416 return TypeFeedbackVector::GetIndex(slot); |
3426 } | 3417 } |
3427 | 3418 |
3428 } // namespace interpreter | 3419 } // namespace interpreter |
3429 } // namespace internal | 3420 } // namespace internal |
3430 } // namespace v8 | 3421 } // namespace v8 |
OLD | NEW |