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/compiler/interpreter-assembler.h" | 5 #include "src/compiler/interpreter-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 Node* shared_info = | 292 Node* shared_info = |
293 LoadObjectField(function, JSFunction::kSharedFunctionInfoOffset); | 293 LoadObjectField(function, JSFunction::kSharedFunctionInfoOffset); |
294 Node* vector = | 294 Node* vector = |
295 LoadObjectField(shared_info, SharedFunctionInfo::kFeedbackVectorOffset); | 295 LoadObjectField(shared_info, SharedFunctionInfo::kFeedbackVectorOffset); |
296 return vector; | 296 return vector; |
297 } | 297 } |
298 | 298 |
299 | 299 |
300 Node* InterpreterAssembler::CallJS(Node* function, Node* first_arg, | 300 Node* InterpreterAssembler::CallJS(Node* function, Node* first_arg, |
301 Node* arg_count) { | 301 Node* arg_count) { |
302 Callable builtin = CodeFactory::PushArgsAndCall(isolate()); | 302 Callable builtin = CodeFactory::InterpreterPushArgsAndCall(isolate()); |
303 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 303 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
304 isolate(), zone(), builtin.descriptor(), 0, CallDescriptor::kNoFlags); | 304 isolate(), zone(), builtin.descriptor(), 0, CallDescriptor::kNoFlags); |
305 | 305 |
306 Node* code_target = HeapConstant(builtin.code()); | 306 Node* code_target = HeapConstant(builtin.code()); |
307 | 307 |
308 Node** args = zone()->NewArray<Node*>(4); | 308 Node** args = zone()->NewArray<Node*>(4); |
309 args[0] = arg_count; | 309 args[0] = arg_count; |
310 args[1] = first_arg; | 310 args[1] = first_arg; |
311 args[2] = function; | 311 args[2] = function; |
312 args[3] = ContextTaggedPointer(); | 312 args[3] = ContextTaggedPointer(); |
(...skipping 30 matching lines...) Expand all Loading... | |
343 args[0] = arg1; | 343 args[0] = arg1; |
344 args[1] = arg2; | 344 args[1] = arg2; |
345 args[2] = arg3; | 345 args[2] = arg3; |
346 args[3] = arg4; | 346 args[3] = arg4; |
347 args[4] = arg5; | 347 args[4] = arg5; |
348 args[5] = ContextTaggedPointer(); | 348 args[5] = ContextTaggedPointer(); |
349 return CallIC(descriptor, target, args); | 349 return CallIC(descriptor, target, args); |
350 } | 350 } |
351 | 351 |
352 | 352 |
353 Node* InterpreterAssembler::CallRuntime(Node* function_id, Node* first_arg, | |
354 Node* arg_count) { | |
355 Callable builtin = CodeFactory::InterpreterCEntry(isolate()); | |
Michael Starzinger
2015/09/29 08:28:34
nit: This is no longer a "builtin", should we just
rmcilroy
2015/10/01 17:02:44
Done.
| |
356 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | |
357 isolate(), zone(), builtin.descriptor(), 0, CallDescriptor::kNoFlags); | |
358 | |
359 Node* code_target = HeapConstant(builtin.code()); | |
360 | |
361 // Get the function entry from the function id. | |
362 Node* function_table = raw_assembler_->ExternalConstant( | |
363 ExternalReference::runtime_function_table_address(isolate())); | |
364 Node* function_offset = raw_assembler_->Int32Mul( | |
365 function_id, Int32Constant(sizeof(Runtime::Function))); | |
366 Node* function = IntPtrAdd(function_table, function_offset); | |
367 Node* function_entry = raw_assembler_->Load( | |
368 kMachPtr, function, Int32Constant(offsetof(Runtime::Function, entry))); | |
369 | |
370 Node** args = zone()->NewArray<Node*>(4); | |
371 args[0] = arg_count; | |
372 args[1] = first_arg; | |
373 args[2] = function_entry; | |
374 args[3] = ContextTaggedPointer(); | |
375 | |
376 return raw_assembler_->CallN(descriptor, code_target, args); | |
377 } | |
378 | |
379 | |
353 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 380 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, |
354 Node* arg1) { | 381 Node* arg1) { |
355 return raw_assembler_->CallRuntime1(function_id, arg1, | 382 return raw_assembler_->CallRuntime1(function_id, arg1, |
356 ContextTaggedPointer()); | 383 ContextTaggedPointer()); |
357 } | 384 } |
358 | 385 |
359 | 386 |
360 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 387 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, |
361 Node* arg1, Node* arg2) { | 388 Node* arg1, Node* arg2) { |
362 return raw_assembler_->CallRuntime2(function_id, arg1, arg2, | 389 return raw_assembler_->CallRuntime2(function_id, arg1, arg2, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 return raw_assembler_->schedule(); | 505 return raw_assembler_->schedule(); |
479 } | 506 } |
480 | 507 |
481 | 508 |
482 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 509 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
483 | 510 |
484 | 511 |
485 } // namespace interpreter | 512 } // namespace interpreter |
486 } // namespace internal | 513 } // namespace internal |
487 } // namespace v8 | 514 } // namespace v8 |
OLD | NEW |