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 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 } | 2243 } |
2244 // The context may be an intermediate context, not a function context. | 2244 // The context may be an intermediate context, not a function context. |
2245 movq(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 2245 movq(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
2246 } else { // context is the current function context. | 2246 } else { // context is the current function context. |
2247 // The context may be an intermediate context, not a function context. | 2247 // The context may be an intermediate context, not a function context. |
2248 movq(dst, Operand(rsi, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 2248 movq(dst, Operand(rsi, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
2249 } | 2249 } |
2250 } | 2250 } |
2251 | 2251 |
2252 | 2252 |
| 2253 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 2254 // Load the global or builtins object from the current context. |
| 2255 movq(function, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 2256 // Load the global context from the global or builtins object. |
| 2257 movq(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); |
| 2258 // Load the function from the global context. |
| 2259 movq(function, Operand(function, Context::SlotOffset(index))); |
| 2260 } |
| 2261 |
| 2262 |
| 2263 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 2264 Register map) { |
| 2265 // Load the initial map. The global functions all have initial maps. |
| 2266 movq(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 2267 if (FLAG_debug_code) { |
| 2268 Label ok, fail; |
| 2269 CheckMap(map, Factory::meta_map(), &fail, false); |
| 2270 jmp(&ok); |
| 2271 bind(&fail); |
| 2272 Abort("Global functions must have initial map"); |
| 2273 bind(&ok); |
| 2274 } |
| 2275 } |
| 2276 |
| 2277 |
2253 int MacroAssembler::ArgumentStackSlotsForCFunctionCall(int num_arguments) { | 2278 int MacroAssembler::ArgumentStackSlotsForCFunctionCall(int num_arguments) { |
2254 // On Windows 64 stack slots are reserved by the caller for all arguments | 2279 // On Windows 64 stack slots are reserved by the caller for all arguments |
2255 // including the ones passed in registers, and space is always allocated for | 2280 // including the ones passed in registers, and space is always allocated for |
2256 // the four register arguments even if the function takes fewer than four | 2281 // the four register arguments even if the function takes fewer than four |
2257 // arguments. | 2282 // arguments. |
2258 // On AMD64 ABI (Linux/Mac) the first six arguments are passed in registers | 2283 // On AMD64 ABI (Linux/Mac) the first six arguments are passed in registers |
2259 // and the caller does not reserve stack slots for them. | 2284 // and the caller does not reserve stack slots for them. |
2260 ASSERT(num_arguments >= 0); | 2285 ASSERT(num_arguments >= 0); |
2261 #ifdef _WIN64 | 2286 #ifdef _WIN64 |
2262 static const int kMinimumStackSlots = 4; | 2287 static const int kMinimumStackSlots = 4; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2321 CPU::FlushICache(address_, size_); | 2346 CPU::FlushICache(address_, size_); |
2322 | 2347 |
2323 // Check that the code was patched as expected. | 2348 // Check that the code was patched as expected. |
2324 ASSERT(masm_.pc_ == address_ + size_); | 2349 ASSERT(masm_.pc_ == address_ + size_); |
2325 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2350 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2326 } | 2351 } |
2327 | 2352 |
2328 } } // namespace v8::internal | 2353 } } // namespace v8::internal |
2329 | 2354 |
2330 #endif // V8_TARGET_ARCH_X64 | 2355 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |