| 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/compiler.h" | 8 #include "src/compiler.h" | 
| 9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" | 
| 10 #include "src/interpreter/control-flow-builders.h" | 10 #include "src/interpreter/control-flow-builders.h" | 
| (...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2450 | 2450 | 
| 2451   // Evaluate all arguments to the function call and store in sequential | 2451   // Evaluate all arguments to the function call and store in sequential | 
| 2452   // registers. | 2452   // registers. | 
| 2453   Register arg = VisitArguments(args); | 2453   Register arg = VisitArguments(args); | 
| 2454   CHECK(args->length() == 0 || arg.index() == receiver.index() + 1); | 2454   CHECK(args->length() == 0 || arg.index() == receiver.index() + 1); | 
| 2455 | 2455 | 
| 2456   // Resolve callee for a potential direct eval call. This block will mutate the | 2456   // Resolve callee for a potential direct eval call. This block will mutate the | 
| 2457   // callee value. | 2457   // callee value. | 
| 2458   if (call_type == Call::POSSIBLY_EVAL_CALL && args->length() > 0) { | 2458   if (call_type == Call::POSSIBLY_EVAL_CALL && args->length() > 0) { | 
| 2459     RegisterAllocationScope inner_register_scope(this); | 2459     RegisterAllocationScope inner_register_scope(this); | 
| 2460     register_allocator()->PrepareForConsecutiveAllocations(5); | 2460     register_allocator()->PrepareForConsecutiveAllocations(6); | 
| 2461     Register callee_for_eval = register_allocator()->NextConsecutiveRegister(); | 2461     Register callee_for_eval = register_allocator()->NextConsecutiveRegister(); | 
| 2462     Register source = register_allocator()->NextConsecutiveRegister(); | 2462     Register source = register_allocator()->NextConsecutiveRegister(); | 
| 2463     Register function = register_allocator()->NextConsecutiveRegister(); | 2463     Register function = register_allocator()->NextConsecutiveRegister(); | 
| 2464     Register language = register_allocator()->NextConsecutiveRegister(); | 2464     Register language = register_allocator()->NextConsecutiveRegister(); | 
| 2465     Register position = register_allocator()->NextConsecutiveRegister(); | 2465     Register eval_scope_position = | 
|  | 2466         register_allocator()->NextConsecutiveRegister(); | 
|  | 2467     Register eval_position = register_allocator()->NextConsecutiveRegister(); | 
| 2466 | 2468 | 
| 2467     // Set up arguments for ResolvePossiblyDirectEval by copying callee, source | 2469     // Set up arguments for ResolvePossiblyDirectEval by copying callee, source | 
| 2468     // strings and function closure, and loading language and | 2470     // strings and function closure, and loading language and | 
| 2469     // position. | 2471     // position. | 
| 2470     builder() | 2472     builder() | 
| 2471         ->MoveRegister(callee, callee_for_eval) | 2473         ->MoveRegister(callee, callee_for_eval) | 
| 2472         .MoveRegister(arg, source) | 2474         .MoveRegister(arg, source) | 
| 2473         .MoveRegister(Register::function_closure(), function) | 2475         .MoveRegister(Register::function_closure(), function) | 
| 2474         .LoadLiteral(Smi::FromInt(language_mode())) | 2476         .LoadLiteral(Smi::FromInt(language_mode())) | 
| 2475         .StoreAccumulatorInRegister(language) | 2477         .StoreAccumulatorInRegister(language) | 
| 2476         .LoadLiteral( | 2478         .LoadLiteral( | 
| 2477             Smi::FromInt(execution_context()->scope()->start_position())) | 2479             Smi::FromInt(execution_context()->scope()->start_position())) | 
| 2478         .StoreAccumulatorInRegister(position); | 2480         .StoreAccumulatorInRegister(eval_scope_position) | 
|  | 2481         .LoadLiteral(Smi::FromInt(expr->position())) | 
|  | 2482         .StoreAccumulatorInRegister(eval_position); | 
| 2479 | 2483 | 
| 2480     // Call ResolvePossiblyDirectEval and modify the callee. | 2484     // Call ResolvePossiblyDirectEval and modify the callee. | 
| 2481     builder() | 2485     builder() | 
| 2482         ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 5) | 2486         ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 6) | 
| 2483         .StoreAccumulatorInRegister(callee); | 2487         .StoreAccumulatorInRegister(callee); | 
| 2484   } | 2488   } | 
| 2485 | 2489 | 
| 2486   builder()->SetExpressionPosition(expr); | 2490   builder()->SetExpressionPosition(expr); | 
| 2487   builder()->Call(callee, receiver, 1 + args->length(), | 2491   builder()->Call(callee, receiver, 1 + args->length(), | 
| 2488                   feedback_index(expr->CallFeedbackICSlot()), | 2492                   feedback_index(expr->CallFeedbackICSlot()), | 
| 2489                   expr->tail_call_mode()); | 2493                   expr->tail_call_mode()); | 
| 2490   execution_result()->SetResultInAccumulator(); | 2494   execution_result()->SetResultInAccumulator(); | 
| 2491 } | 2495 } | 
| 2492 | 2496 | 
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3160 } | 3164 } | 
| 3161 | 3165 | 
| 3162 | 3166 | 
| 3163 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3167 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 
| 3164   return info()->shared_info()->feedback_vector()->GetIndex(slot); | 3168   return info()->shared_info()->feedback_vector()->GetIndex(slot); | 
| 3165 } | 3169 } | 
| 3166 | 3170 | 
| 3167 }  // namespace interpreter | 3171 }  // namespace interpreter | 
| 3168 }  // namespace internal | 3172 }  // namespace internal | 
| 3169 }  // namespace v8 | 3173 }  // namespace v8 | 
| OLD | NEW | 
|---|