OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { | 1513 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { |
1514 Register result = ToRegister(instr->result()); | 1514 Register result = ToRegister(instr->result()); |
1515 __ movq(result, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 1515 __ movq(result, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
1516 __ movq(result, FieldOperand(result, GlobalObject::kGlobalReceiverOffset)); | 1516 __ movq(result, FieldOperand(result, GlobalObject::kGlobalReceiverOffset)); |
1517 } | 1517 } |
1518 | 1518 |
1519 | 1519 |
1520 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, | 1520 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, |
1521 int arity, | 1521 int arity, |
1522 LInstruction* instr) { | 1522 LInstruction* instr) { |
1523 Abort("Unimplemented: %s", "CallKnownFunction"); | 1523 // Change context if needed. |
| 1524 bool change_context = |
| 1525 (graph()->info()->closure()->context() != function->context()) || |
| 1526 scope()->contains_with() || |
| 1527 (scope()->num_heap_slots() > 0); |
| 1528 if (change_context) { |
| 1529 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 1530 } |
| 1531 |
| 1532 // Set eax to arguments count if adaption is not needed. Assumes that eax |
| 1533 // is available to write to at this point. |
| 1534 if (!function->NeedsArgumentsAdaption()) { |
| 1535 __ Set(rax, arity); |
| 1536 } |
| 1537 |
| 1538 LPointerMap* pointers = instr->pointer_map(); |
| 1539 RecordPosition(pointers->position()); |
| 1540 |
| 1541 // Invoke function. |
| 1542 if (*function == *graph()->info()->closure()) { |
| 1543 __ CallSelf(); |
| 1544 } else { |
| 1545 __ call(FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
| 1546 } |
| 1547 |
| 1548 // Setup deoptimization. |
| 1549 RegisterLazyDeoptimization(instr); |
| 1550 |
| 1551 // Restore context. |
| 1552 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
1524 } | 1553 } |
1525 | 1554 |
1526 | 1555 |
1527 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { | 1556 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { |
1528 Abort("Unimplemented: %s", "DoCallConstantFunction"); | 1557 ASSERT(ToRegister(instr->result()).is(eax)); |
| 1558 __ Move(rdi, instr->function()); |
| 1559 CallKnownFunction(instr->function(), instr->arity(), instr); |
1529 } | 1560 } |
1530 | 1561 |
1531 | 1562 |
1532 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { | 1563 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { |
1533 Abort("Unimplemented: %s", "DoDeferredMathAbsTaggedHeapNumber"); | 1564 Abort("Unimplemented: %s", "DoDeferredMathAbsTaggedHeapNumber"); |
1534 } | 1565 } |
1535 | 1566 |
1536 | 1567 |
1537 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { | 1568 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { |
1538 Abort("Unimplemented: %s", "DoMathAbs"); | 1569 Abort("Unimplemented: %s", "DoMathAbs"); |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 | 2037 |
2007 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2038 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
2008 Abort("Unimplemented: %s", "DoOsrEntry"); | 2039 Abort("Unimplemented: %s", "DoOsrEntry"); |
2009 } | 2040 } |
2010 | 2041 |
2011 #undef __ | 2042 #undef __ |
2012 | 2043 |
2013 } } // namespace v8::internal | 2044 } } // namespace v8::internal |
2014 | 2045 |
2015 #endif // V8_TARGET_ARCH_X64 | 2046 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |