OLD | NEW |
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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 } | 1362 } |
1363 // The context may be an intermediate context, not a function context. | 1363 // The context may be an intermediate context, not a function context. |
1364 mov(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 1364 mov(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
1365 } else { // Slot is in the current function context. | 1365 } else { // Slot is in the current function context. |
1366 // The context may be an intermediate context, not a function context. | 1366 // The context may be an intermediate context, not a function context. |
1367 mov(dst, Operand(esi, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 1367 mov(dst, Operand(esi, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
1368 } | 1368 } |
1369 } | 1369 } |
1370 | 1370 |
1371 | 1371 |
| 1372 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 1373 // Load the global or builtins object from the current context. |
| 1374 mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 1375 // Load the global context from the global or builtins object. |
| 1376 mov(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); |
| 1377 // Load the function from the global context. |
| 1378 mov(function, Operand(function, Context::SlotOffset(index))); |
| 1379 } |
| 1380 |
| 1381 |
| 1382 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 1383 Register map) { |
| 1384 // Load the initial map. The global functions all have initial maps. |
| 1385 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1386 if (FLAG_debug_code) { |
| 1387 Label ok, fail; |
| 1388 CheckMap(map, Factory::meta_map(), &fail, false); |
| 1389 jmp(&ok); |
| 1390 bind(&fail); |
| 1391 Abort("Global functions must have initial map"); |
| 1392 bind(&ok); |
| 1393 } |
| 1394 } |
| 1395 |
1372 | 1396 |
1373 void MacroAssembler::Ret() { | 1397 void MacroAssembler::Ret() { |
1374 ret(0); | 1398 ret(0); |
1375 } | 1399 } |
1376 | 1400 |
1377 | 1401 |
1378 void MacroAssembler::Drop(int stack_elements) { | 1402 void MacroAssembler::Drop(int stack_elements) { |
1379 if (stack_elements > 0) { | 1403 if (stack_elements > 0) { |
1380 add(Operand(esp), Immediate(stack_elements * kPointerSize)); | 1404 add(Operand(esp), Immediate(stack_elements * kPointerSize)); |
1381 } | 1405 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 | 1699 |
1676 // Check that the code was patched as expected. | 1700 // Check that the code was patched as expected. |
1677 ASSERT(masm_.pc_ == address_ + size_); | 1701 ASSERT(masm_.pc_ == address_ + size_); |
1678 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1702 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1679 } | 1703 } |
1680 | 1704 |
1681 | 1705 |
1682 } } // namespace v8::internal | 1706 } } // namespace v8::internal |
1683 | 1707 |
1684 #endif // V8_TARGET_ARCH_IA32 | 1708 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |