OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 SharedFunctionInfo::kFormalParameterCountOffset)); | 538 SharedFunctionInfo::kFormalParameterCountOffset)); |
539 ldr(code_reg, | 539 ldr(code_reg, |
540 MemOperand(code_reg, SharedFunctionInfo::kCodeOffset - kHeapObjectTag)); | 540 MemOperand(code_reg, SharedFunctionInfo::kCodeOffset - kHeapObjectTag)); |
541 add(code_reg, code_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | 541 add(code_reg, code_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
542 | 542 |
543 ParameterCount expected(expected_reg); | 543 ParameterCount expected(expected_reg); |
544 InvokeCode(code_reg, expected, actual, flag); | 544 InvokeCode(code_reg, expected, actual, flag); |
545 } | 545 } |
546 | 546 |
547 | 547 |
| 548 void MacroAssembler::InvokeFunction(JSFunction* function, |
| 549 const ParameterCount& actual) { |
| 550 ASSERT(function->is_compiled()); |
| 551 |
| 552 // Get the function and setup the context. |
| 553 mov(r1, Operand(Handle<JSFunction>(function))); |
| 554 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 555 |
| 556 // Jump to the cached code (tail call). |
| 557 Handle<Code> code(function->code()); |
| 558 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 559 InvokeCode(code, expected, actual, |
| 560 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 561 } |
| 562 |
548 #ifdef ENABLE_DEBUGGER_SUPPORT | 563 #ifdef ENABLE_DEBUGGER_SUPPORT |
549 void MacroAssembler::SaveRegistersToMemory(RegList regs) { | 564 void MacroAssembler::SaveRegistersToMemory(RegList regs) { |
550 ASSERT((regs & ~kJSCallerSaved) == 0); | 565 ASSERT((regs & ~kJSCallerSaved) == 0); |
551 // Copy the content of registers to memory location. | 566 // Copy the content of registers to memory location. |
552 for (int i = 0; i < kNumJSCallerSaved; i++) { | 567 for (int i = 0; i < kNumJSCallerSaved; i++) { |
553 int r = JSCallerSavedCode(i); | 568 int r = JSCallerSavedCode(i); |
554 if ((regs & (1 << r)) != 0) { | 569 if ((regs & (1 << r)) != 0) { |
555 Register reg = { r }; | 570 Register reg = { r }; |
556 mov(ip, Operand(ExternalReference(Debug_Address::Register(i)))); | 571 mov(ip, Operand(ExternalReference(Debug_Address::Register(i)))); |
557 str(reg, MemOperand(ip)); | 572 str(reg, MemOperand(ip)); |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 CEntryStub stub(1); | 1217 CEntryStub stub(1); |
1203 CallStub(&stub); | 1218 CallStub(&stub); |
1204 } | 1219 } |
1205 | 1220 |
1206 | 1221 |
1207 void MacroAssembler::CallRuntime(Runtime::FunctionId fid, int num_arguments) { | 1222 void MacroAssembler::CallRuntime(Runtime::FunctionId fid, int num_arguments) { |
1208 CallRuntime(Runtime::FunctionForId(fid), num_arguments); | 1223 CallRuntime(Runtime::FunctionForId(fid), num_arguments); |
1209 } | 1224 } |
1210 | 1225 |
1211 | 1226 |
| 1227 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
| 1228 int num_arguments) { |
| 1229 mov(r0, Operand(num_arguments)); |
| 1230 mov(r1, Operand(ext)); |
| 1231 |
| 1232 CEntryStub stub(1); |
| 1233 CallStub(&stub); |
| 1234 } |
| 1235 |
| 1236 |
1212 void MacroAssembler::TailCallRuntime(const ExternalReference& ext, | 1237 void MacroAssembler::TailCallRuntime(const ExternalReference& ext, |
1213 int num_arguments, | 1238 int num_arguments, |
1214 int result_size) { | 1239 int result_size) { |
1215 // TODO(1236192): Most runtime routines don't need the number of | 1240 // TODO(1236192): Most runtime routines don't need the number of |
1216 // arguments passed in because it is constant. At some point we | 1241 // arguments passed in because it is constant. At some point we |
1217 // should remove this need and make the runtime routine entry code | 1242 // should remove this need and make the runtime routine entry code |
1218 // smarter. | 1243 // smarter. |
1219 mov(r0, Operand(num_arguments)); | 1244 mov(r0, Operand(num_arguments)); |
1220 JumpToRuntime(ext); | 1245 JumpToRuntime(ext); |
1221 } | 1246 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 } | 1467 } |
1443 | 1468 |
1444 | 1469 |
1445 void CodePatcher::Emit(Address addr) { | 1470 void CodePatcher::Emit(Address addr) { |
1446 masm()->emit(reinterpret_cast<Instr>(addr)); | 1471 masm()->emit(reinterpret_cast<Instr>(addr)); |
1447 } | 1472 } |
1448 #endif // ENABLE_DEBUGGER_SUPPORT | 1473 #endif // ENABLE_DEBUGGER_SUPPORT |
1449 | 1474 |
1450 | 1475 |
1451 } } // namespace v8::internal | 1476 } } // namespace v8::internal |
OLD | NEW |