OLD | NEW |
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 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 | 1993 |
1994 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { | 1994 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { |
1995 Register arguments = ToRegister(instr->arguments()); | 1995 Register arguments = ToRegister(instr->arguments()); |
1996 Register length = ToRegister(instr->length()); | 1996 Register length = ToRegister(instr->length()); |
1997 Operand index = ToOperand(instr->index()); | 1997 Operand index = ToOperand(instr->index()); |
1998 Register result = ToRegister(instr->result()); | 1998 Register result = ToRegister(instr->result()); |
1999 | 1999 |
2000 __ sub(length, index); | 2000 __ sub(length, index); |
2001 DeoptimizeIf(below_equal, instr->environment()); | 2001 DeoptimizeIf(below_equal, instr->environment()); |
2002 | 2002 |
| 2003 // There are two words between the frame pointer and the last argument. |
| 2004 // Subtracting from length accounts for one of them add one more. |
2003 __ mov(result, Operand(arguments, length, times_4, kPointerSize)); | 2005 __ mov(result, Operand(arguments, length, times_4, kPointerSize)); |
2004 } | 2006 } |
2005 | 2007 |
2006 | 2008 |
2007 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { | 2009 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
2008 Register elements = ToRegister(instr->elements()); | 2010 Register elements = ToRegister(instr->elements()); |
2009 Register key = ToRegister(instr->key()); | 2011 Register key = ToRegister(instr->key()); |
2010 Register result; | 2012 Register result; |
2011 if (instr->load_result() != NULL) { | 2013 if (instr->load_result() != NULL) { |
2012 result = ToRegister(instr->load_result()); | 2014 result = ToRegister(instr->load_result()); |
(...skipping 29 matching lines...) Expand all Loading... |
2042 | 2044 |
2043 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 2045 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
2044 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2046 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2045 } | 2047 } |
2046 | 2048 |
2047 | 2049 |
2048 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 2050 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
2049 Register result = ToRegister(instr->result()); | 2051 Register result = ToRegister(instr->result()); |
2050 | 2052 |
2051 // Check for arguments adapter frame. | 2053 // Check for arguments adapter frame. |
2052 Label done, adapted; | 2054 NearLabel done, adapted; |
2053 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 2055 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
2054 __ mov(result, Operand(result, StandardFrameConstants::kContextOffset)); | 2056 __ mov(result, Operand(result, StandardFrameConstants::kContextOffset)); |
2055 __ cmp(Operand(result), | 2057 __ cmp(Operand(result), |
2056 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2058 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
2057 __ j(equal, &adapted); | 2059 __ j(equal, &adapted); |
2058 | 2060 |
2059 // No arguments adaptor frame. | 2061 // No arguments adaptor frame. |
2060 __ mov(result, Operand(ebp)); | 2062 __ mov(result, Operand(ebp)); |
2061 __ jmp(&done); | 2063 __ jmp(&done); |
2062 | 2064 |
2063 // Arguments adaptor frame present. | 2065 // Arguments adaptor frame present. |
2064 __ bind(&adapted); | 2066 __ bind(&adapted); |
2065 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 2067 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
2066 | 2068 |
2067 // Done. Pointer to topmost argument is in result. | 2069 // Result is the frame pointer for the frame if not adapted and for the real |
| 2070 // frame below the adaptor frame if adapted. |
2068 __ bind(&done); | 2071 __ bind(&done); |
2069 } | 2072 } |
2070 | 2073 |
2071 | 2074 |
2072 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) { | 2075 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) { |
2073 Operand elem = ToOperand(instr->input()); | 2076 Operand elem = ToOperand(instr->input()); |
2074 Register result = ToRegister(instr->result()); | 2077 Register result = ToRegister(instr->result()); |
2075 | 2078 |
2076 Label done; | 2079 NearLabel done; |
2077 | 2080 |
2078 // No arguments adaptor frame. Number of arguments is fixed. | 2081 // If no arguments adaptor frame the number of arguments is fixed. |
2079 __ cmp(ebp, elem); | 2082 __ cmp(ebp, elem); |
2080 __ mov(result, Immediate(scope()->num_parameters())); | 2083 __ mov(result, Immediate(scope()->num_parameters())); |
2081 __ j(equal, &done); | 2084 __ j(equal, &done); |
2082 | 2085 |
2083 // Arguments adaptor frame present. Get argument length from there. | 2086 // Arguments adaptor frame present. Get argument length from there. |
2084 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 2087 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
2085 __ mov(result, Operand(result, | 2088 __ mov(result, Operand(result, |
2086 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2089 ArgumentsAdaptorFrameConstants::kLengthOffset)); |
2087 __ SmiUntag(result); | 2090 __ SmiUntag(result); |
2088 | 2091 |
2089 // Done. Argument length is in result register. | 2092 // Argument length is in result register. |
2090 __ bind(&done); | 2093 __ bind(&done); |
2091 } | 2094 } |
2092 | 2095 |
2093 | 2096 |
2094 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 2097 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
2095 Register receiver = ToRegister(instr->receiver()); | 2098 Register receiver = ToRegister(instr->receiver()); |
2096 ASSERT(ToRegister(instr->function()).is(edi)); | 2099 ASSERT(ToRegister(instr->function()).is(edi)); |
2097 ASSERT(ToRegister(instr->result()).is(eax)); | 2100 ASSERT(ToRegister(instr->result()).is(eax)); |
2098 | 2101 |
2099 // If the receiver is null or undefined, we have to pass the | 2102 // If the receiver is null or undefined, we have to pass the |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 ASSERT(!environment->HasBeenRegistered()); | 3404 ASSERT(!environment->HasBeenRegistered()); |
3402 RegisterEnvironmentForDeoptimization(environment); | 3405 RegisterEnvironmentForDeoptimization(environment); |
3403 ASSERT(osr_pc_offset_ == -1); | 3406 ASSERT(osr_pc_offset_ == -1); |
3404 osr_pc_offset_ = masm()->pc_offset(); | 3407 osr_pc_offset_ = masm()->pc_offset(); |
3405 } | 3408 } |
3406 | 3409 |
3407 | 3410 |
3408 #undef __ | 3411 #undef __ |
3409 | 3412 |
3410 } } // namespace v8::internal | 3413 } } // namespace v8::internal |
OLD | NEW |