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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void LCodeGen::FinishCode(Handle<Code> code) { | 85 void LCodeGen::FinishCode(Handle<Code> code) { |
86 ASSERT(is_done()); | 86 ASSERT(is_done()); |
87 code->set_stack_slots(StackSlotCount()); | 87 code->set_stack_slots(StackSlotCount()); |
88 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 88 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
89 PopulateDeoptimizationData(code); | 89 PopulateDeoptimizationData(code); |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 void LCodeGen::Abort(const char* format, ...) { | 93 void LCodeGen::Abort(const char* format, ...) { |
94 if (FLAG_trace_bailout) { | 94 if (FLAG_trace_bailout) { |
95 SmartPointer<char> debug_name = graph()->debug_name()->ToCString(); | 95 SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString()); |
96 PrintF("Aborting LCodeGen in @\"%s\": ", *debug_name); | 96 PrintF("Aborting LCodeGen in @\"%s\": ", *name); |
97 va_list arguments; | 97 va_list arguments; |
98 va_start(arguments, format); | 98 va_start(arguments, format); |
99 OS::VPrint(format, arguments); | 99 OS::VPrint(format, arguments); |
100 va_end(arguments); | 100 va_end(arguments); |
101 PrintF("\n"); | 101 PrintF("\n"); |
102 } | 102 } |
103 status_ = ABORTED; | 103 status_ = ABORTED; |
104 } | 104 } |
105 | 105 |
106 | 106 |
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 __ movq(result, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2286 __ movq(result, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
2287 __ movq(result, FieldOperand(result, GlobalObject::kGlobalReceiverOffset)); | 2287 __ movq(result, FieldOperand(result, GlobalObject::kGlobalReceiverOffset)); |
2288 } | 2288 } |
2289 | 2289 |
2290 | 2290 |
2291 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, | 2291 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, |
2292 int arity, | 2292 int arity, |
2293 LInstruction* instr) { | 2293 LInstruction* instr) { |
2294 // Change context if needed. | 2294 // Change context if needed. |
2295 bool change_context = | 2295 bool change_context = |
2296 (graph()->info()->closure()->context() != function->context()) || | 2296 (info()->closure()->context() != function->context()) || |
2297 scope()->contains_with() || | 2297 scope()->contains_with() || |
2298 (scope()->num_heap_slots() > 0); | 2298 (scope()->num_heap_slots() > 0); |
2299 if (change_context) { | 2299 if (change_context) { |
2300 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 2300 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
2301 } | 2301 } |
2302 | 2302 |
2303 // Set rax to arguments count if adaption is not needed. Assumes that rax | 2303 // Set rax to arguments count if adaption is not needed. Assumes that rax |
2304 // is available to write to at this point. | 2304 // is available to write to at this point. |
2305 if (!function->NeedsArgumentsAdaption()) { | 2305 if (!function->NeedsArgumentsAdaption()) { |
2306 __ Set(rax, arity); | 2306 __ Set(rax, arity); |
2307 } | 2307 } |
2308 | 2308 |
2309 LPointerMap* pointers = instr->pointer_map(); | 2309 LPointerMap* pointers = instr->pointer_map(); |
2310 RecordPosition(pointers->position()); | 2310 RecordPosition(pointers->position()); |
2311 | 2311 |
2312 // Invoke function. | 2312 // Invoke function. |
2313 if (*function == *graph()->info()->closure()) { | 2313 if (*function == *info()->closure()) { |
2314 __ CallSelf(); | 2314 __ CallSelf(); |
2315 } else { | 2315 } else { |
2316 __ call(FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 2316 __ call(FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
2317 } | 2317 } |
2318 | 2318 |
2319 // Setup deoptimization. | 2319 // Setup deoptimization. |
2320 RegisterLazyDeoptimization(instr); | 2320 RegisterLazyDeoptimization(instr); |
2321 | 2321 |
2322 // Restore context. | 2322 // Restore context. |
2323 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2323 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3648 RegisterEnvironmentForDeoptimization(environment); | 3648 RegisterEnvironmentForDeoptimization(environment); |
3649 ASSERT(osr_pc_offset_ == -1); | 3649 ASSERT(osr_pc_offset_ == -1); |
3650 osr_pc_offset_ = masm()->pc_offset(); | 3650 osr_pc_offset_ = masm()->pc_offset(); |
3651 } | 3651 } |
3652 | 3652 |
3653 #undef __ | 3653 #undef __ |
3654 | 3654 |
3655 } } // namespace v8::internal | 3655 } } // namespace v8::internal |
3656 | 3656 |
3657 #endif // V8_TARGET_ARCH_X64 | 3657 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |