Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 6606006: [Isolates] Merge 6500:6700 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3758 matching lines...) Expand 10 before | Expand all | Expand 10 after
3769 3769
3770 // Add a label for checking the size of the code used for returning. 3770 // Add a label for checking the size of the code used for returning.
3771 #ifdef DEBUG 3771 #ifdef DEBUG
3772 Label check_exit_codesize; 3772 Label check_exit_codesize;
3773 masm_->bind(&check_exit_codesize); 3773 masm_->bind(&check_exit_codesize);
3774 #endif 3774 #endif
3775 3775
3776 // Leave the frame and return popping the arguments and the 3776 // Leave the frame and return popping the arguments and the
3777 // receiver. 3777 // receiver.
3778 frame_->Exit(); 3778 frame_->Exit();
3779 masm_->ret((scope()->num_parameters() + 1) * kPointerSize); 3779 int arguments_bytes = (scope()->num_parameters() + 1) * kPointerSize;
3780 __ Ret(arguments_bytes, ecx);
3780 DeleteFrame(); 3781 DeleteFrame();
3781 3782
3782 #ifdef ENABLE_DEBUGGER_SUPPORT 3783 #ifdef ENABLE_DEBUGGER_SUPPORT
3783 // Check that the size of the code used for returning matches what is 3784 // Check that the size of the code used for returning is large enough
3784 // expected by the debugger. 3785 // for the debugger's requirements.
3785 ASSERT_EQ(Assembler::kJSReturnSequenceLength, 3786 ASSERT(Assembler::kJSReturnSequenceLength <=
3786 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); 3787 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
3787 #endif 3788 #endif
3788 } 3789 }
3789 3790
3790 3791
3791 void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) { 3792 void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) {
3792 ASSERT(!in_spilled_code()); 3793 ASSERT(!in_spilled_code());
3793 Comment cmnt(masm_, "[ WithEnterStatement"); 3794 Comment cmnt(masm_, "[ WithEnterStatement");
3794 CodeForStatementPosition(node); 3795 CodeForStatementPosition(node);
3795 Load(node->expression()); 3796 Load(node->expression());
3796 Result context; 3797 Result context;
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after
6100 NOT_INSIDE_TYPEOF, 6101 NOT_INSIDE_TYPEOF,
6101 &slow); 6102 &slow);
6102 frame_->Push(&fun); 6103 frame_->Push(&fun);
6103 if (arg_count > 0) { 6104 if (arg_count > 0) {
6104 frame_->PushElementAt(arg_count); 6105 frame_->PushElementAt(arg_count);
6105 } else { 6106 } else {
6106 frame_->Push(FACTORY->undefined_value()); 6107 frame_->Push(FACTORY->undefined_value());
6107 } 6108 }
6108 frame_->PushParameterAt(-1); 6109 frame_->PushParameterAt(-1);
6109 6110
6111 // Push the strict mode flag.
6112 frame_->Push(Smi::FromInt(strict_mode_flag()));
6113
6110 // Resolve the call. 6114 // Resolve the call.
6111 result = 6115 result =
6112 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEvalNoLookup, 3); 6116 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEvalNoLookup, 4);
6113 6117
6114 done.Jump(&result); 6118 done.Jump(&result);
6115 slow.Bind(); 6119 slow.Bind();
6116 } 6120 }
6117 6121
6118 // Prepare the stack for the call to ResolvePossiblyDirectEval by 6122 // Prepare the stack for the call to ResolvePossiblyDirectEval by
6119 // pushing the loaded function, the first argument to the eval 6123 // pushing the loaded function, the first argument to the eval
6120 // call and the receiver. 6124 // call and the receiver.
6121 frame_->PushElementAt(arg_count + 1); 6125 frame_->PushElementAt(arg_count + 1);
6122 if (arg_count > 0) { 6126 if (arg_count > 0) {
6123 frame_->PushElementAt(arg_count); 6127 frame_->PushElementAt(arg_count);
6124 } else { 6128 } else {
6125 frame_->Push(FACTORY->undefined_value()); 6129 frame_->Push(FACTORY->undefined_value());
6126 } 6130 }
6127 frame_->PushParameterAt(-1); 6131 frame_->PushParameterAt(-1);
6128 6132
6133 // Push the strict mode flag.
6134 frame_->Push(Smi::FromInt(strict_mode_flag()));
6135
6129 // Resolve the call. 6136 // Resolve the call.
6130 result = frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 3); 6137 result = frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 4);
6131 6138
6132 // If we generated fast-case code bind the jump-target where fast 6139 // If we generated fast-case code bind the jump-target where fast
6133 // and slow case merge. 6140 // and slow case merge.
6134 if (done.is_linked()) done.Bind(&result); 6141 if (done.is_linked()) done.Bind(&result);
6135 6142
6136 // The runtime call returns a pair of values in eax (function) and 6143 // The runtime call returns a pair of values in eax (function) and
6137 // edx (receiver). Touch up the stack with the right values. 6144 // edx (receiver). Touch up the stack with the right values.
6138 Result receiver = allocator_->Allocate(edx); 6145 Result receiver = allocator_->Allocate(edx);
6139 frame_->SetElementAt(arg_count + 1, &result); 6146 frame_->SetElementAt(arg_count + 1, &result);
6140 frame_->SetElementAt(arg_count, &receiver); 6147 frame_->SetElementAt(arg_count, &receiver);
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
7949 // Test for -0.5. 7956 // Test for -0.5.
7950 // Load xmm2 with -0.5. 7957 // Load xmm2 with -0.5.
7951 __ mov(answer.reg(), Immediate(0xBF000000)); 7958 __ mov(answer.reg(), Immediate(0xBF000000));
7952 __ movd(xmm2, Operand(answer.reg())); 7959 __ movd(xmm2, Operand(answer.reg()));
7953 __ cvtss2sd(xmm2, xmm2); 7960 __ cvtss2sd(xmm2, xmm2);
7954 // xmm2 now has -0.5. 7961 // xmm2 now has -0.5.
7955 __ ucomisd(xmm2, xmm1); 7962 __ ucomisd(xmm2, xmm1);
7956 __ j(not_equal, &not_minus_half); 7963 __ j(not_equal, &not_minus_half);
7957 7964
7958 // Calculates reciprocal of square root. 7965 // Calculates reciprocal of square root.
7959 // Note that 1/sqrt(x) = sqrt(1/x)) 7966 // sqrtsd returns -0 when input is -0. ECMA spec requires +0.
7960 __ divsd(xmm3, xmm0); 7967 __ xorpd(xmm1, xmm1);
7968 __ addsd(xmm1, xmm0);
7969 __ sqrtsd(xmm1, xmm1);
7970 __ divsd(xmm3, xmm1);
7961 __ movsd(xmm1, xmm3); 7971 __ movsd(xmm1, xmm3);
7962 __ sqrtsd(xmm1, xmm1);
7963 __ jmp(&allocate_return); 7972 __ jmp(&allocate_return);
7964 7973
7965 // Test for 0.5. 7974 // Test for 0.5.
7966 __ bind(&not_minus_half); 7975 __ bind(&not_minus_half);
7967 // Load xmm2 with 0.5. 7976 // Load xmm2 with 0.5.
7968 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. 7977 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3.
7969 __ addsd(xmm2, xmm3); 7978 __ addsd(xmm2, xmm3);
7970 // xmm2 now has 0.5. 7979 // xmm2 now has 0.5.
7971 __ ucomisd(xmm2, xmm1); 7980 __ ucomisd(xmm2, xmm1);
7972 call_runtime.Branch(not_equal); 7981 call_runtime.Branch(not_equal);
7973 // Calculates square root. 7982 // Calculates square root.
7974 __ movsd(xmm1, xmm0); 7983 // sqrtsd returns -0 when input is -0. ECMA spec requires +0.
7984 __ xorpd(xmm1, xmm1);
7985 __ addsd(xmm1, xmm0);
7975 __ sqrtsd(xmm1, xmm1); 7986 __ sqrtsd(xmm1, xmm1);
7976 7987
7977 JumpTarget done; 7988 JumpTarget done;
7978 Label failure, success; 7989 Label failure, success;
7979 __ bind(&allocate_return); 7990 __ bind(&allocate_return);
7980 // Make a copy of the frame to enable us to handle allocation 7991 // Make a copy of the frame to enable us to handle allocation
7981 // failure after the JumpTarget jump. 7992 // failure after the JumpTarget jump.
7982 VirtualFrame* clone = new VirtualFrame(frame()); 7993 VirtualFrame* clone = new VirtualFrame(frame());
7983 __ AllocateHeapNumber(answer.reg(), exponent.reg(), 7994 __ AllocateHeapNumber(answer.reg(), exponent.reg(),
7984 base.reg(), &failure); 7995 base.reg(), &failure);
(...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after
10320 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); 10331 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size);
10321 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); 10332 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size);
10322 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); 10333 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress());
10323 } 10334 }
10324 10335
10325 #undef __ 10336 #undef __
10326 10337
10327 } } // namespace v8::internal 10338 } } // namespace v8::internal
10328 10339
10329 #endif // V8_TARGET_ARCH_IA32 10340 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698