| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 void LCodeGen::FinishCode(Handle<Code> code) { | 86 void LCodeGen::FinishCode(Handle<Code> code) { |
| 87 ASSERT(is_done()); | 87 ASSERT(is_done()); |
| 88 code->set_stack_slots(StackSlotCount()); | 88 code->set_stack_slots(StackSlotCount()); |
| 89 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 89 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 90 PopulateDeoptimizationData(code); | 90 PopulateDeoptimizationData(code); |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 void LCodeGen::Abort(const char* format, ...) { | 94 void LCodeGen::Abort(const char* format, ...) { |
| 95 if (FLAG_trace_bailout) { | 95 if (FLAG_trace_bailout) { |
| 96 SmartPointer<char> debug_name = graph()->debug_name()->ToCString(); | 96 SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString()); |
| 97 PrintF("Aborting LCodeGen in @\"%s\": ", *debug_name); | 97 PrintF("Aborting LCodeGen in @\"%s\": ", *name); |
| 98 va_list arguments; | 98 va_list arguments; |
| 99 va_start(arguments, format); | 99 va_start(arguments, format); |
| 100 OS::VPrint(format, arguments); | 100 OS::VPrint(format, arguments); |
| 101 va_end(arguments); | 101 va_end(arguments); |
| 102 PrintF("\n"); | 102 PrintF("\n"); |
| 103 } | 103 } |
| 104 status_ = ABORTED; | 104 status_ = ABORTED; |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| (...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 InstanceofStub stub(flags); | 1916 InstanceofStub stub(flags); |
| 1917 | 1917 |
| 1918 // Get the temp register reserved by the instruction. This needs to be edi as | 1918 // Get the temp register reserved by the instruction. This needs to be edi as |
| 1919 // its slot of the pushing of safepoint registers is used to communicate the | 1919 // its slot of the pushing of safepoint registers is used to communicate the |
| 1920 // offset to the location of the map check. | 1920 // offset to the location of the map check. |
| 1921 Register temp = ToRegister(instr->TempAt(0)); | 1921 Register temp = ToRegister(instr->TempAt(0)); |
| 1922 ASSERT(temp.is(edi)); | 1922 ASSERT(temp.is(edi)); |
| 1923 __ mov(InstanceofStub::right(), Immediate(instr->function())); | 1923 __ mov(InstanceofStub::right(), Immediate(instr->function())); |
| 1924 static const int kAdditionalDelta = 16; | 1924 static const int kAdditionalDelta = 16; |
| 1925 int delta = masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta; | 1925 int delta = masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta; |
| 1926 Label before_push_delta; | |
| 1927 __ bind(&before_push_delta); | |
| 1928 __ mov(temp, Immediate(delta)); | 1926 __ mov(temp, Immediate(delta)); |
| 1929 __ StoreToSafepointRegisterSlot(temp, temp); | 1927 __ StoreToSafepointRegisterSlot(temp, temp); |
| 1930 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); | 1928 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); |
| 1931 // Put the result value into the eax slot and restore all registers. | 1929 // Put the result value into the eax slot and restore all registers. |
| 1932 __ StoreToSafepointRegisterSlot(eax, eax); | 1930 __ StoreToSafepointRegisterSlot(eax, eax); |
| 1933 __ PopSafepointRegisters(); | 1931 __ PopSafepointRegisters(); |
| 1934 } | 1932 } |
| 1935 | 1933 |
| 1936 | 1934 |
| 1937 static Condition ComputeCompareCondition(Token::Value op) { | 1935 static Condition ComputeCompareCondition(Token::Value op) { |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2358 Register result = ToRegister(instr->result()); | 2356 Register result = ToRegister(instr->result()); |
| 2359 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset)); | 2357 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset)); |
| 2360 } | 2358 } |
| 2361 | 2359 |
| 2362 | 2360 |
| 2363 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, | 2361 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, |
| 2364 int arity, | 2362 int arity, |
| 2365 LInstruction* instr) { | 2363 LInstruction* instr) { |
| 2366 // Change context if needed. | 2364 // Change context if needed. |
| 2367 bool change_context = | 2365 bool change_context = |
| 2368 (graph()->info()->closure()->context() != function->context()) || | 2366 (info()->closure()->context() != function->context()) || |
| 2369 scope()->contains_with() || | 2367 scope()->contains_with() || |
| 2370 (scope()->num_heap_slots() > 0); | 2368 (scope()->num_heap_slots() > 0); |
| 2371 if (change_context) { | 2369 if (change_context) { |
| 2372 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 2370 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
| 2373 } else { | 2371 } else { |
| 2374 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2372 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2375 } | 2373 } |
| 2376 | 2374 |
| 2377 // Set eax to arguments count if adaption is not needed. Assumes that eax | 2375 // Set eax to arguments count if adaption is not needed. Assumes that eax |
| 2378 // is available to write to at this point. | 2376 // is available to write to at this point. |
| 2379 if (!function->NeedsArgumentsAdaption()) { | 2377 if (!function->NeedsArgumentsAdaption()) { |
| 2380 __ mov(eax, arity); | 2378 __ mov(eax, arity); |
| 2381 } | 2379 } |
| 2382 | 2380 |
| 2383 LPointerMap* pointers = instr->pointer_map(); | 2381 LPointerMap* pointers = instr->pointer_map(); |
| 2384 RecordPosition(pointers->position()); | 2382 RecordPosition(pointers->position()); |
| 2385 | 2383 |
| 2386 // Invoke function. | 2384 // Invoke function. |
| 2387 if (*function == *graph()->info()->closure()) { | 2385 if (*function == *info()->closure()) { |
| 2388 __ CallSelf(); | 2386 __ CallSelf(); |
| 2389 } else { | 2387 } else { |
| 2390 __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset)); | 2388 __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset)); |
| 2391 EnsureRelocSpaceForDeoptimization(); | 2389 EnsureRelocSpaceForDeoptimization(); |
| 2392 } | 2390 } |
| 2393 | 2391 |
| 2394 // Setup deoptimization. | 2392 // Setup deoptimization. |
| 2395 RegisterLazyDeoptimization(instr); | 2393 RegisterLazyDeoptimization(instr); |
| 2396 } | 2394 } |
| 2397 | 2395 |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3882 ASSERT(osr_pc_offset_ == -1); | 3880 ASSERT(osr_pc_offset_ == -1); |
| 3883 osr_pc_offset_ = masm()->pc_offset(); | 3881 osr_pc_offset_ = masm()->pc_offset(); |
| 3884 } | 3882 } |
| 3885 | 3883 |
| 3886 | 3884 |
| 3887 #undef __ | 3885 #undef __ |
| 3888 | 3886 |
| 3889 } } // namespace v8::internal | 3887 } } // namespace v8::internal |
| 3890 | 3888 |
| 3891 #endif // V8_TARGET_ARCH_IA32 | 3889 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |