| OLD | NEW | 
|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 594   call(stub->GetCode(), RelocInfo::CODE_TARGET); | 594   call(stub->GetCode(), RelocInfo::CODE_TARGET); | 
| 595 } | 595 } | 
| 596 | 596 | 
| 597 | 597 | 
| 598 void MacroAssembler::StubReturn(int argc) { | 598 void MacroAssembler::StubReturn(int argc) { | 
| 599   ASSERT(argc >= 1 && generating_stub()); | 599   ASSERT(argc >= 1 && generating_stub()); | 
| 600   ret((argc - 1) * kPointerSize); | 600   ret((argc - 1) * kPointerSize); | 
| 601 } | 601 } | 
| 602 | 602 | 
| 603 | 603 | 
| 604 void MacroAssembler::IllegalOperation() { | 604 void MacroAssembler::IllegalOperation(int num_arguments) { | 
| 605   push(Immediate(Factory::undefined_value())); | 605   if (num_arguments > 0) { | 
|  | 606     add(Operand(esp), Immediate(num_arguments * kPointerSize)); | 
|  | 607   } | 
|  | 608   mov(Operand(eax), Immediate(Factory::undefined_value())); | 
| 606 } | 609 } | 
| 607 | 610 | 
| 608 | 611 | 
| 609 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { | 612 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { | 
| 610   CallRuntime(Runtime::FunctionForId(id), num_arguments); | 613   CallRuntime(Runtime::FunctionForId(id), num_arguments); | 
| 611 } | 614 } | 
| 612 | 615 | 
| 613 | 616 | 
| 614 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { | 617 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { | 
| 615   // If the expected number of arguments of the runtime function is | 618   // If the expected number of arguments of the runtime function is | 
| 616   // constant, we check that the actual number of arguments match the | 619   // constant, we check that the actual number of arguments match the | 
| 617   // expectation. | 620   // expectation. | 
| 618   if (f->nargs >= 0 && f->nargs != num_arguments) { | 621   if (f->nargs >= 0 && f->nargs != num_arguments) { | 
| 619     IllegalOperation(); | 622     IllegalOperation(num_arguments); | 
| 620     return; | 623     return; | 
| 621   } | 624   } | 
| 622 | 625 | 
| 623   Runtime::FunctionId function_id = | 626   Runtime::FunctionId function_id = | 
| 624       static_cast<Runtime::FunctionId>(f->stub_id); | 627       static_cast<Runtime::FunctionId>(f->stub_id); | 
| 625   RuntimeStub stub(function_id, num_arguments); | 628   RuntimeStub stub(function_id, num_arguments); | 
| 626   CallStub(&stub); | 629   CallStub(&stub); | 
| 627 } | 630 } | 
| 628 | 631 | 
| 629 | 632 | 
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 912   // Indicate that code has changed. | 915   // Indicate that code has changed. | 
| 913   CPU::FlushICache(address_, size_); | 916   CPU::FlushICache(address_, size_); | 
| 914 | 917 | 
| 915   // Check that the code was patched as expected. | 918   // Check that the code was patched as expected. | 
| 916   ASSERT(masm_.pc_ == address_ + size_); | 919   ASSERT(masm_.pc_ == address_ + size_); | 
| 917   ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 920   ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 
| 918 } | 921 } | 
| 919 | 922 | 
| 920 | 923 | 
| 921 } }  // namespace v8::internal | 924 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|