Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 596096: Refactoring various pieces of post interceptor caching. (Closed)
Patch Set: Fix incorrect indentation Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 // arguments passed in because it is constant. At some point we 1138 // arguments passed in because it is constant. At some point we
1139 // should remove this need and make the runtime routine entry code 1139 // should remove this need and make the runtime routine entry code
1140 // smarter. 1140 // smarter.
1141 Set(eax, Immediate(num_arguments)); 1141 Set(eax, Immediate(num_arguments));
1142 mov(ebx, Immediate(ExternalReference(f))); 1142 mov(ebx, Immediate(ExternalReference(f)));
1143 CEntryStub ces(1); 1143 CEntryStub ces(1);
1144 CallStub(&ces); 1144 CallStub(&ces);
1145 } 1145 }
1146 1146
1147 1147
1148 void MacroAssembler::CallExternalReference(ExternalReference ref,
1149 int num_arguments) {
1150 mov(eax, Immediate(num_arguments));
1151 mov(ebx, Immediate(ref));
1152
1153 CEntryStub stub(1);
1154 CallStub(&stub);
1155 }
1156
1157
1148 Object* MacroAssembler::TryCallRuntime(Runtime::Function* f, 1158 Object* MacroAssembler::TryCallRuntime(Runtime::Function* f,
1149 int num_arguments) { 1159 int num_arguments) {
1150 if (f->nargs >= 0 && f->nargs != num_arguments) { 1160 if (f->nargs >= 0 && f->nargs != num_arguments) {
1151 IllegalOperation(num_arguments); 1161 IllegalOperation(num_arguments);
1152 // Since we did not call the stub, there was no allocation failure. 1162 // Since we did not call the stub, there was no allocation failure.
1153 // Return some non-failure object. 1163 // Return some non-failure object.
1154 return Heap::undefined_value(); 1164 return Heap::undefined_value();
1155 } 1165 }
1156 1166
1157 // TODO(1236192): Most runtime routines don't need the number of 1167 // TODO(1236192): Most runtime routines don't need the number of
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 1368 mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
1359 mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); 1369 mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset));
1360 mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); 1370 mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset));
1361 lea(edx, FieldOperand(edx, Code::kHeaderSize)); 1371 lea(edx, FieldOperand(edx, Code::kHeaderSize));
1362 1372
1363 ParameterCount expected(ebx); 1373 ParameterCount expected(ebx);
1364 InvokeCode(Operand(edx), expected, actual, flag); 1374 InvokeCode(Operand(edx), expected, actual, flag);
1365 } 1375 }
1366 1376
1367 1377
1378 void MacroAssembler::InvokeFunction(JSFunction* function,
1379 const ParameterCount& actual) {
1380 ASSERT(function->is_compiled());
1381 // Get the function and setup the context.
1382 mov(edi, Immediate(Handle<JSFunction>(function)));
1383 mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
1384
1385 // Jump to the cached code (tail call).
1386 Handle<Code> code(function->code());
1387 ParameterCount expected(function->shared()->formal_parameter_count());
1388 InvokeCode(code, expected, actual, RelocInfo::CODE_TARGET, JUMP_FUNCTION);
1389 }
1390
1391
1368 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) { 1392 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) {
1369 // Calls are not allowed in some stubs. 1393 // Calls are not allowed in some stubs.
1370 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); 1394 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls());
1371 1395
1372 // Rely on the assertion to check that the number of provided 1396 // Rely on the assertion to check that the number of provided
1373 // arguments match the expected number of arguments. Fake a 1397 // arguments match the expected number of arguments. Fake a
1374 // parameter count to avoid emitting code to do the check. 1398 // parameter count to avoid emitting code to do the check.
1375 ParameterCount expected(0); 1399 ParameterCount expected(0);
1376 GetBuiltinEntry(edx, id); 1400 GetBuiltinEntry(edx, id);
1377 InvokeCode(Operand(edx), expected, expected, flag); 1401 InvokeCode(Operand(edx), expected, expected, flag);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 // Indicate that code has changed. 1616 // Indicate that code has changed.
1593 CPU::FlushICache(address_, size_); 1617 CPU::FlushICache(address_, size_);
1594 1618
1595 // Check that the code was patched as expected. 1619 // Check that the code was patched as expected.
1596 ASSERT(masm_.pc_ == address_ + size_); 1620 ASSERT(masm_.pc_ == address_ + size_);
1597 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1621 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1598 } 1622 }
1599 1623
1600 1624
1601 } } // namespace v8::internal 1625 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698