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

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

Issue 5699003: Use correct calling convention for API calls on MinGW (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rename flag Created 10 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 1209
1210 1210
1211 MaybeObject* MacroAssembler::TryTailCallRuntime(Runtime::FunctionId fid, 1211 MaybeObject* MacroAssembler::TryTailCallRuntime(Runtime::FunctionId fid,
1212 int num_arguments, 1212 int num_arguments,
1213 int result_size) { 1213 int result_size) {
1214 return TryTailCallExternalReference( 1214 return TryTailCallExternalReference(
1215 ExternalReference(fid), num_arguments, result_size); 1215 ExternalReference(fid), num_arguments, result_size);
1216 } 1216 }
1217 1217
1218 1218
1219 // If true, a Handle<T> passed by value is passed and returned by 1219 // If true, a Handle<T> returned by value from a function with cdecl calling
1220 // using the location_ field directly. If false, it is passed and 1220 // convention will be returned directly as a value of location_ field in a
1221 // returned as a pointer to a handle. 1221 // register eax.
1222 #ifdef USING_BSD_ABI 1222 // If false, it is returned as a pointer to a preallocated by caller memory
1223 static const bool kPassHandlesDirectly = true; 1223 // region. Pointer to this region should be passed to a function as an
1224 // implicit first argument.
1225 #if defined(USING_BSD_ABI) || defined(__MINGW32__)
antonm 2010/12/09 19:35:34 I'd rather moved defined(__MINGW32__) into src/glo
Erik Corry 2010/12/10 11:35:20 I agree with Anton.
Vyacheslav Egorov (Chromium) 2010/12/10 11:40:04 I committed as is. I do not think that defining US
1226 static const bool kReturnHandlesDirectly = true;
1224 #else 1227 #else
1225 static const bool kPassHandlesDirectly = false; 1228 static const bool kReturnHandlesDirectly = false;
1226 #endif 1229 #endif
1227 1230
1228 1231
1229 Operand ApiParameterOperand(int index) { 1232 Operand ApiParameterOperand(int index) {
1230 return Operand(esp, (index + (kPassHandlesDirectly ? 0 : 1)) * kPointerSize); 1233 return Operand(esp, (index + (kReturnHandlesDirectly ? 0 : 1)) * kPointerSize) ;
Erik Corry 2010/12/10 11:35:20 lint?
1231 } 1234 }
1232 1235
1233 1236
1234 void MacroAssembler::PrepareCallApiFunction(int argc, Register scratch) { 1237 void MacroAssembler::PrepareCallApiFunction(int argc, Register scratch) {
1235 if (kPassHandlesDirectly) { 1238 if (kReturnHandlesDirectly) {
1236 EnterApiExitFrame(argc); 1239 EnterApiExitFrame(argc);
1237 // When handles as passed directly we don't have to allocate extra 1240 // When handles are returned directly we don't have to allocate extra
1238 // space for and pass an out parameter. 1241 // space for and pass an out parameter.
1239 } else { 1242 } else {
1240 // We allocate two additional slots: return value and pointer to it. 1243 // We allocate two additional slots: return value and pointer to it.
1241 EnterApiExitFrame(argc + 2); 1244 EnterApiExitFrame(argc + 2);
1242 1245
1243 // The argument slots are filled as follows: 1246 // The argument slots are filled as follows:
1244 // 1247 //
1245 // n + 1: output cell 1248 // n + 1: output cell
1246 // n: arg n 1249 // n: arg n
1247 // ... 1250 // ...
(...skipping 24 matching lines...) Expand all
1272 ExternalReference::handle_scope_level_address(); 1275 ExternalReference::handle_scope_level_address();
1273 1276
1274 // Allocate HandleScope in callee-save registers. 1277 // Allocate HandleScope in callee-save registers.
1275 mov(ebx, Operand::StaticVariable(next_address)); 1278 mov(ebx, Operand::StaticVariable(next_address));
1276 mov(edi, Operand::StaticVariable(limit_address)); 1279 mov(edi, Operand::StaticVariable(limit_address));
1277 add(Operand::StaticVariable(level_address), Immediate(1)); 1280 add(Operand::StaticVariable(level_address), Immediate(1));
1278 1281
1279 // Call the api function! 1282 // Call the api function!
1280 call(function->address(), RelocInfo::RUNTIME_ENTRY); 1283 call(function->address(), RelocInfo::RUNTIME_ENTRY);
1281 1284
1282 if (!kPassHandlesDirectly) { 1285 if (!kReturnHandlesDirectly) {
1283 // The returned value is a pointer to the handle holding the result. 1286 // The returned value is a pointer to the handle holding the result.
1284 // Dereference this to get to the location. 1287 // Dereference this to get to the location.
1285 mov(eax, Operand(eax, 0)); 1288 mov(eax, Operand(eax, 0));
1286 } 1289 }
1287 1290
1288 Label empty_handle; 1291 Label empty_handle;
1289 Label prologue; 1292 Label prologue;
1290 Label promote_scheduled_exception; 1293 Label promote_scheduled_exception;
1291 Label delete_allocated_handles; 1294 Label delete_allocated_handles;
1292 Label leave_exit_frame; 1295 Label leave_exit_frame;
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1914
1912 // Check that the code was patched as expected. 1915 // Check that the code was patched as expected.
1913 ASSERT(masm_.pc_ == address_ + size_); 1916 ASSERT(masm_.pc_ == address_ + size_);
1914 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1917 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1915 } 1918 }
1916 1919
1917 1920
1918 } } // namespace v8::internal 1921 } } // namespace v8::internal
1919 1922
1920 #endif // V8_TARGET_ARCH_IA32 1923 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698