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