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

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

Issue 2840018: [Isolates] Moved more compilation-related globals (builtins, runtime, &c.)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: rebase Created 10 years, 6 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 | Annotate | Revision Log
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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 CallRuntime(Runtime::FunctionForId(id), num_arguments); 1087 CallRuntime(Runtime::FunctionForId(id), num_arguments);
1088 } 1088 }
1089 1089
1090 1090
1091 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id, 1091 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id,
1092 int num_arguments) { 1092 int num_arguments) {
1093 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments); 1093 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments);
1094 } 1094 }
1095 1095
1096 1096
1097 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { 1097 void MacroAssembler::CallRuntime(const Runtime::Function* f,
1098 int num_arguments) {
1098 // If the expected number of arguments of the runtime function is 1099 // If the expected number of arguments of the runtime function is
1099 // constant, we check that the actual number of arguments match the 1100 // constant, we check that the actual number of arguments match the
1100 // expectation. 1101 // expectation.
1101 if (f->nargs >= 0 && f->nargs != num_arguments) { 1102 if (f->nargs >= 0 && f->nargs != num_arguments) {
1102 IllegalOperation(num_arguments); 1103 IllegalOperation(num_arguments);
1103 return; 1104 return;
1104 } 1105 }
1105 1106
1106 // TODO(1236192): Most runtime routines don't need the number of 1107 // TODO(1236192): Most runtime routines don't need the number of
1107 // arguments passed in because it is constant. At some point we 1108 // arguments passed in because it is constant. At some point we
1108 // should remove this need and make the runtime routine entry code 1109 // should remove this need and make the runtime routine entry code
1109 // smarter. 1110 // smarter.
1110 Set(eax, Immediate(num_arguments)); 1111 Set(eax, Immediate(num_arguments));
1111 mov(ebx, Immediate(ExternalReference(f))); 1112 mov(ebx, Immediate(ExternalReference(f)));
1112 CEntryStub ces(1); 1113 CEntryStub ces(1);
1113 CallStub(&ces); 1114 CallStub(&ces);
1114 } 1115 }
1115 1116
1116 1117
1117 void MacroAssembler::CallExternalReference(ExternalReference ref, 1118 void MacroAssembler::CallExternalReference(ExternalReference ref,
1118 int num_arguments) { 1119 int num_arguments) {
1119 mov(eax, Immediate(num_arguments)); 1120 mov(eax, Immediate(num_arguments));
1120 mov(ebx, Immediate(ref)); 1121 mov(ebx, Immediate(ref));
1121 1122
1122 CEntryStub stub(1); 1123 CEntryStub stub(1);
1123 CallStub(&stub); 1124 CallStub(&stub);
1124 } 1125 }
1125 1126
1126 1127
1127 Object* MacroAssembler::TryCallRuntime(Runtime::Function* f, 1128 Object* MacroAssembler::TryCallRuntime(const Runtime::Function* f,
1128 int num_arguments) { 1129 int num_arguments) {
1129 if (f->nargs >= 0 && f->nargs != num_arguments) { 1130 if (f->nargs >= 0 && f->nargs != num_arguments) {
1130 IllegalOperation(num_arguments); 1131 IllegalOperation(num_arguments);
1131 // Since we did not call the stub, there was no allocation failure. 1132 // Since we did not call the stub, there was no allocation failure.
1132 // Return some non-failure object. 1133 // Return some non-failure object.
1133 return HEAP->undefined_value(); 1134 return HEAP->undefined_value();
1134 } 1135 }
1135 1136
1136 // TODO(1236192): Most runtime routines don't need the number of 1137 // TODO(1236192): Most runtime routines don't need the number of
1137 // arguments passed in because it is constant. At some point we 1138 // arguments passed in because it is constant. At some point we
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 // is the case when we invoke functions using call and apply. 1277 // is the case when we invoke functions using call and apply.
1277 cmp(expected.reg(), Operand(actual.reg())); 1278 cmp(expected.reg(), Operand(actual.reg()));
1278 j(equal, &invoke); 1279 j(equal, &invoke);
1279 ASSERT(actual.reg().is(eax)); 1280 ASSERT(actual.reg().is(eax));
1280 ASSERT(expected.reg().is(ebx)); 1281 ASSERT(expected.reg().is(ebx));
1281 } 1282 }
1282 } 1283 }
1283 1284
1284 if (!definitely_matches) { 1285 if (!definitely_matches) {
1285 Handle<Code> adaptor = 1286 Handle<Code> adaptor =
1286 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); 1287 Handle<Code>(Isolate::Current()->builtins()->builtin(
1288 Builtins::ArgumentsAdaptorTrampoline));
1287 if (!code_constant.is_null()) { 1289 if (!code_constant.is_null()) {
1288 mov(edx, Immediate(code_constant)); 1290 mov(edx, Immediate(code_constant));
1289 add(Operand(edx), Immediate(Code::kHeaderSize - kHeapObjectTag)); 1291 add(Operand(edx), Immediate(Code::kHeaderSize - kHeapObjectTag));
1290 } else if (!code_operand.is_reg(edx)) { 1292 } else if (!code_operand.is_reg(edx)) {
1291 mov(edx, code_operand); 1293 mov(edx, code_operand);
1292 } 1294 }
1293 1295
1294 if (flag == CALL_FUNCTION) { 1296 if (flag == CALL_FUNCTION) {
1295 call(adaptor, RelocInfo::CODE_TARGET); 1297 call(adaptor, RelocInfo::CODE_TARGET);
1296 jmp(done); 1298 jmp(done);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 1665
1664 // Check that the code was patched as expected. 1666 // Check that the code was patched as expected.
1665 ASSERT(masm_.pc_ == address_ + size_); 1667 ASSERT(masm_.pc_ == address_ + size_);
1666 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1668 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1667 } 1669 }
1668 1670
1669 1671
1670 } } // namespace v8::internal 1672 } } // namespace v8::internal
1671 1673
1672 #endif // V8_TARGET_ARCH_IA32 1674 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | src/runtime.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698