OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 void MacroAssembler::CallExternalReference(const ExternalReference& ext, | 389 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
390 int num_arguments) { | 390 int num_arguments) { |
391 movq(rax, Immediate(num_arguments)); | 391 movq(rax, Immediate(num_arguments)); |
392 movq(rbx, ext); | 392 movq(rbx, ext); |
393 | 393 |
394 CEntryStub stub(1); | 394 CEntryStub stub(1); |
395 CallStub(&stub); | 395 CallStub(&stub); |
396 } | 396 } |
397 | 397 |
398 | 398 |
399 void MacroAssembler::TailCallRuntime(ExternalReference const& ext, | 399 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, |
400 int num_arguments, | 400 int num_arguments, |
401 int result_size) { | 401 int result_size) { |
402 // ----------- S t a t e ------------- | 402 // ----------- S t a t e ------------- |
403 // -- rsp[0] : return address | 403 // -- rsp[0] : return address |
404 // -- rsp[8] : argument num_arguments - 1 | 404 // -- rsp[8] : argument num_arguments - 1 |
405 // ... | 405 // ... |
406 // -- rsp[8 * num_arguments] : argument 0 (receiver) | 406 // -- rsp[8 * num_arguments] : argument 0 (receiver) |
407 // ----------------------------------- | 407 // ----------------------------------- |
408 | 408 |
409 // TODO(1236192): Most runtime routines don't need the number of | 409 // TODO(1236192): Most runtime routines don't need the number of |
410 // arguments passed in because it is constant. At some point we | 410 // arguments passed in because it is constant. At some point we |
411 // should remove this need and make the runtime routine entry code | 411 // should remove this need and make the runtime routine entry code |
412 // smarter. | 412 // smarter. |
413 movq(rax, Immediate(num_arguments)); | 413 movq(rax, Immediate(num_arguments)); |
414 JumpToRuntime(ext, result_size); | 414 JumpToExternalReference(ext, result_size); |
415 } | 415 } |
416 | 416 |
417 | 417 |
418 void MacroAssembler::JumpToRuntime(const ExternalReference& ext, | 418 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid, |
419 int result_size) { | 419 int num_arguments, |
| 420 int result_size) { |
| 421 TailCallExternalReference(ExternalReference(fid), num_arguments, result_size); |
| 422 } |
| 423 |
| 424 |
| 425 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext, |
| 426 int result_size) { |
420 // Set the entry point and jump to the C entry runtime stub. | 427 // Set the entry point and jump to the C entry runtime stub. |
421 movq(rbx, ext); | 428 movq(rbx, ext); |
422 CEntryStub ces(result_size); | 429 CEntryStub ces(result_size); |
423 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); | 430 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); |
424 } | 431 } |
425 | 432 |
426 | 433 |
427 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) { | 434 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) { |
428 // Calls are not allowed in some stubs. | 435 // Calls are not allowed in some stubs. |
429 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); | 436 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); |
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 CodePatcher::~CodePatcher() { | 2584 CodePatcher::~CodePatcher() { |
2578 // Indicate that code has changed. | 2585 // Indicate that code has changed. |
2579 CPU::FlushICache(address_, size_); | 2586 CPU::FlushICache(address_, size_); |
2580 | 2587 |
2581 // Check that the code was patched as expected. | 2588 // Check that the code was patched as expected. |
2582 ASSERT(masm_.pc_ == address_ + size_); | 2589 ASSERT(masm_.pc_ == address_ + size_); |
2583 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2590 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2584 } | 2591 } |
2585 | 2592 |
2586 } } // namespace v8::internal | 2593 } } // namespace v8::internal |
OLD | NEW |