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

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

Issue 201042: Win64 - Allow returning two values from a runtime function. (Closed)
Patch Set: Fixed typo. Created 11 years, 3 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
OLDNEW
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 6868 matching lines...) Expand 10 before | Expand all | Expand 10 after
6879 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, eax); 6879 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, eax);
6880 __ j(above_equal, &not_string1); 6880 __ j(above_equal, &not_string1);
6881 6881
6882 // First argument is a a string, test second. 6882 // First argument is a a string, test second.
6883 __ test(edx, Immediate(kSmiTagMask)); 6883 __ test(edx, Immediate(kSmiTagMask));
6884 __ j(zero, &string1); 6884 __ j(zero, &string1);
6885 __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, edx); 6885 __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, edx);
6886 __ j(above_equal, &string1); 6886 __ j(above_equal, &string1);
6887 6887
6888 // First and second argument are strings. 6888 // First and second argument are strings.
6889 __ TailCallRuntime(ExternalReference(Runtime::kStringAdd), 2); 6889 __ TailCallRuntime(ExternalReference(Runtime::kStringAdd), 2, 1);
6890 6890
6891 // Only first argument is a string. 6891 // Only first argument is a string.
6892 __ bind(&string1); 6892 __ bind(&string1);
6893 __ InvokeBuiltin(Builtins::STRING_ADD_LEFT, JUMP_FUNCTION); 6893 __ InvokeBuiltin(Builtins::STRING_ADD_LEFT, JUMP_FUNCTION);
6894 6894
6895 // First argument was not a string, test second. 6895 // First argument was not a string, test second.
6896 __ bind(&not_string1); 6896 __ bind(&not_string1);
6897 __ test(edx, Immediate(kSmiTagMask)); 6897 __ test(edx, Immediate(kSmiTagMask));
6898 __ j(zero, &not_strings); 6898 __ j(zero, &not_strings);
6899 __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, edx); 6899 __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, edx);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
7169 __ neg(edx); 7169 __ neg(edx);
7170 __ mov(eax, Operand(ebx, edx, times_2, kDisplacement)); 7170 __ mov(eax, Operand(ebx, edx, times_2, kDisplacement));
7171 __ ret(0); 7171 __ ret(0);
7172 7172
7173 // Slow-case: Handle non-smi or out-of-bounds access to arguments 7173 // Slow-case: Handle non-smi or out-of-bounds access to arguments
7174 // by calling the runtime system. 7174 // by calling the runtime system.
7175 __ bind(&slow); 7175 __ bind(&slow);
7176 __ pop(ebx); // Return address. 7176 __ pop(ebx); // Return address.
7177 __ push(edx); 7177 __ push(edx);
7178 __ push(ebx); 7178 __ push(ebx);
7179 __ TailCallRuntime(ExternalReference(Runtime::kGetArgumentsProperty), 1); 7179 __ TailCallRuntime(ExternalReference(Runtime::kGetArgumentsProperty), 1, 1);
7180 } 7180 }
7181 7181
7182 7182
7183 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { 7183 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
7184 // The displacement is used for skipping the return address and the 7184 // The displacement is used for skipping the return address and the
7185 // frame pointer on the stack. It is the offset of the last 7185 // frame pointer on the stack. It is the offset of the last
7186 // parameter (if any) relative to the frame pointer. 7186 // parameter (if any) relative to the frame pointer.
7187 static const int kDisplacement = 2 * kPointerSize; 7187 static const int kDisplacement = 2 * kPointerSize;
7188 7188
7189 // Check if the calling frame is an arguments adaptor frame. 7189 // Check if the calling frame is an arguments adaptor frame.
7190 Label runtime; 7190 Label runtime;
7191 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 7191 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
7192 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); 7192 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
7193 __ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 7193 __ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
7194 __ j(not_equal, &runtime); 7194 __ j(not_equal, &runtime);
7195 7195
7196 // Patch the arguments.length and the parameters pointer. 7196 // Patch the arguments.length and the parameters pointer.
7197 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 7197 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
7198 __ mov(Operand(esp, 1 * kPointerSize), ecx); 7198 __ mov(Operand(esp, 1 * kPointerSize), ecx);
7199 __ lea(edx, Operand(edx, ecx, times_2, kDisplacement)); 7199 __ lea(edx, Operand(edx, ecx, times_2, kDisplacement));
7200 __ mov(Operand(esp, 2 * kPointerSize), edx); 7200 __ mov(Operand(esp, 2 * kPointerSize), edx);
7201 7201
7202 // Do the runtime call to allocate the arguments object. 7202 // Do the runtime call to allocate the arguments object.
7203 __ bind(&runtime); 7203 __ bind(&runtime);
7204 __ TailCallRuntime(ExternalReference(Runtime::kNewArgumentsFast), 3); 7204 __ TailCallRuntime(ExternalReference(Runtime::kNewArgumentsFast), 3, 1);
7205 } 7205 }
7206 7206
7207 7207
7208 void CompareStub::Generate(MacroAssembler* masm) { 7208 void CompareStub::Generate(MacroAssembler* masm) {
7209 Label call_builtin, done; 7209 Label call_builtin, done;
7210 7210
7211 // NOTICE! This code is only reached after a smi-fast-case check, so 7211 // NOTICE! This code is only reached after a smi-fast-case check, so
7212 // it is certain that at least one operand isn't a smi. 7212 // it is certain that at least one operand isn't a smi.
7213 7213
7214 if (cc_ == equal) { // Both strict and non-strict. 7214 if (cc_ == equal) { // Both strict and non-strict.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
7430 void StackCheckStub::Generate(MacroAssembler* masm) { 7430 void StackCheckStub::Generate(MacroAssembler* masm) {
7431 // Because builtins always remove the receiver from the stack, we 7431 // Because builtins always remove the receiver from the stack, we
7432 // have to fake one to avoid underflowing the stack. The receiver 7432 // have to fake one to avoid underflowing the stack. The receiver
7433 // must be inserted below the return address on the stack so we 7433 // must be inserted below the return address on the stack so we
7434 // temporarily store that in a register. 7434 // temporarily store that in a register.
7435 __ pop(eax); 7435 __ pop(eax);
7436 __ push(Immediate(Smi::FromInt(0))); 7436 __ push(Immediate(Smi::FromInt(0)));
7437 __ push(eax); 7437 __ push(eax);
7438 7438
7439 // Do tail-call to runtime routine. 7439 // Do tail-call to runtime routine.
7440 __ TailCallRuntime(ExternalReference(Runtime::kStackGuard), 1); 7440 __ TailCallRuntime(ExternalReference(Runtime::kStackGuard), 1, 1);
7441 } 7441 }
7442 7442
7443 7443
7444 void CallFunctionStub::Generate(MacroAssembler* masm) { 7444 void CallFunctionStub::Generate(MacroAssembler* masm) {
7445 Label slow; 7445 Label slow;
7446 7446
7447 // Get the function to call from the stack. 7447 // Get the function to call from the stack.
7448 // +2 ~ receiver, return address 7448 // +2 ~ receiver, return address
7449 __ mov(edi, Operand(esp, (argc_ + 2) * kPointerSize)); 7449 __ mov(edi, Operand(esp, (argc_ + 2) * kPointerSize));
7450 7450
(...skipping 11 matching lines...) Expand all
7462 // Slow-case: Non-function called. 7462 // Slow-case: Non-function called.
7463 __ bind(&slow); 7463 __ bind(&slow);
7464 __ Set(eax, Immediate(argc_)); 7464 __ Set(eax, Immediate(argc_));
7465 __ Set(ebx, Immediate(0)); 7465 __ Set(ebx, Immediate(0));
7466 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); 7466 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
7467 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); 7467 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline));
7468 __ jmp(adaptor, RelocInfo::CODE_TARGET); 7468 __ jmp(adaptor, RelocInfo::CODE_TARGET);
7469 } 7469 }
7470 7470
7471 7471
7472 int CEntryStub::MinorKey() {
7473 ASSERT(result_size_ <= 2);
7474 // Result returned in eax, or eax+edx if result_size_ is 2.
7475 return 0;
7476 }
7477
7478
7472 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { 7479 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
7473 // eax holds the exception. 7480 // eax holds the exception.
7474 7481
7475 // Adjust this code if not the case. 7482 // Adjust this code if not the case.
7476 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); 7483 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
7477 7484
7478 // Drop the sp to the top of the handler. 7485 // Drop the sp to the top of the handler.
7479 ExternalReference handler_address(Top::k_handler_address); 7486 ExternalReference handler_address(Top::k_handler_address);
7480 __ mov(esp, Operand::StaticVariable(handler_address)); 7487 __ mov(esp, Operand::StaticVariable(handler_address));
7481 7488
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
7870 7877
7871 int CompareStub::MinorKey() { 7878 int CompareStub::MinorKey() {
7872 // Encode the two parameters in a unique 16 bit value. 7879 // Encode the two parameters in a unique 16 bit value.
7873 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7880 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7874 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7881 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7875 } 7882 }
7876 7883
7877 #undef __ 7884 #undef __
7878 7885
7879 } } // namespace v8::internal 7886 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698