| OLD | NEW |
| 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 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2254 movq(dst, Operand(rsi, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 2254 movq(dst, Operand(rsi, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
| 2255 } | 2255 } |
| 2256 } | 2256 } |
| 2257 | 2257 |
| 2258 #ifdef _WIN64 | 2258 #ifdef _WIN64 |
| 2259 static const int kRegisterPassedArguments = 4; | 2259 static const int kRegisterPassedArguments = 4; |
| 2260 #else | 2260 #else |
| 2261 static const int kRegisterPassedArguments = 6; | 2261 static const int kRegisterPassedArguments = 6; |
| 2262 #endif | 2262 #endif |
| 2263 | 2263 |
| 2264 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 2265 // Load the global or builtins object from the current context. |
| 2266 movq(function, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 2267 // Load the global context from the global or builtins object. |
| 2268 movq(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); |
| 2269 // Load the function from the global context. |
| 2270 movq(function, Operand(function, Context::SlotOffset(index))); |
| 2271 } |
| 2272 |
| 2273 |
| 2274 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 2275 Register map) { |
| 2276 // Load the initial map. The global functions all have initial maps. |
| 2277 movq(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 2278 if (FLAG_debug_code) { |
| 2279 Label ok, fail; |
| 2280 CheckMap(map, FACTORY->meta_map(), &fail, false); |
| 2281 jmp(&ok); |
| 2282 bind(&fail); |
| 2283 Abort("Global functions must have initial map"); |
| 2284 bind(&ok); |
| 2285 } |
| 2286 } |
| 2287 |
| 2288 |
| 2264 int MacroAssembler::ArgumentStackSlotsForCFunctionCall(int num_arguments) { | 2289 int MacroAssembler::ArgumentStackSlotsForCFunctionCall(int num_arguments) { |
| 2265 // On Windows 64 stack slots are reserved by the caller for all arguments | 2290 // On Windows 64 stack slots are reserved by the caller for all arguments |
| 2266 // including the ones passed in registers, and space is always allocated for | 2291 // including the ones passed in registers, and space is always allocated for |
| 2267 // the four register arguments even if the function takes fewer than four | 2292 // the four register arguments even if the function takes fewer than four |
| 2268 // arguments. | 2293 // arguments. |
| 2269 // On AMD64 ABI (Linux/Mac) the first six arguments are passed in registers | 2294 // On AMD64 ABI (Linux/Mac) the first six arguments are passed in registers |
| 2270 // and the caller does not reserve stack slots for them. | 2295 // and the caller does not reserve stack slots for them. |
| 2271 ASSERT(num_arguments >= 0); | 2296 ASSERT(num_arguments >= 0); |
| 2272 #ifdef _WIN64 | 2297 #ifdef _WIN64 |
| 2273 const int kMinimumStackSlots = kRegisterPassedArguments; | 2298 const int kMinimumStackSlots = kRegisterPassedArguments; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 CPU::FlushICache(address_, size_); | 2381 CPU::FlushICache(address_, size_); |
| 2357 | 2382 |
| 2358 // Check that the code was patched as expected. | 2383 // Check that the code was patched as expected. |
| 2359 ASSERT(masm_.pc_ == address_ + size_); | 2384 ASSERT(masm_.pc_ == address_ + size_); |
| 2360 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2385 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 2361 } | 2386 } |
| 2362 | 2387 |
| 2363 } } // namespace v8::internal | 2388 } } // namespace v8::internal |
| 2364 | 2389 |
| 2365 #endif // V8_TARGET_ARCH_X64 | 2390 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |