| 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 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 __ test(eax, Operand(eax)); | 2002 __ test(eax, Operand(eax)); |
| 2003 __ j(zero, &true_value, Label::kNear); | 2003 __ j(zero, &true_value, Label::kNear); |
| 2004 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2004 __ mov(ToRegister(instr->result()), factory()->false_value()); |
| 2005 __ jmp(&done, Label::kNear); | 2005 __ jmp(&done, Label::kNear); |
| 2006 __ bind(&true_value); | 2006 __ bind(&true_value); |
| 2007 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2007 __ mov(ToRegister(instr->result()), factory()->true_value()); |
| 2008 __ bind(&done); | 2008 __ bind(&done); |
| 2009 } | 2009 } |
| 2010 | 2010 |
| 2011 | 2011 |
| 2012 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { | |
| 2013 ASSERT(ToRegister(instr->context()).is(esi)); | |
| 2014 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
| 2015 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
| 2016 | |
| 2017 InstanceofStub stub(InstanceofStub::kArgsInRegisters); | |
| 2018 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); | |
| 2019 __ test(eax, Operand(eax)); | |
| 2020 EmitBranch(true_block, false_block, zero); | |
| 2021 } | |
| 2022 | |
| 2023 | |
| 2024 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2012 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
| 2025 class DeferredInstanceOfKnownGlobal: public LDeferredCode { | 2013 class DeferredInstanceOfKnownGlobal: public LDeferredCode { |
| 2026 public: | 2014 public: |
| 2027 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2015 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
| 2028 LInstanceOfKnownGlobal* instr) | 2016 LInstanceOfKnownGlobal* instr) |
| 2029 : LDeferredCode(codegen), instr_(instr) { } | 2017 : LDeferredCode(codegen), instr_(instr) { } |
| 2030 virtual void Generate() { | 2018 virtual void Generate() { |
| 2031 codegen()->DoDeferredLInstanceOfKnownGlobal(instr_, &map_check_); | 2019 codegen()->DoDeferredLInstanceOfKnownGlobal(instr_, &map_check_); |
| 2032 } | 2020 } |
| 2033 | 2021 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 __ test(eax, Operand(eax)); | 2141 __ test(eax, Operand(eax)); |
| 2154 __ j(condition, &true_value, Label::kNear); | 2142 __ j(condition, &true_value, Label::kNear); |
| 2155 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2143 __ mov(ToRegister(instr->result()), factory()->false_value()); |
| 2156 __ jmp(&done, Label::kNear); | 2144 __ jmp(&done, Label::kNear); |
| 2157 __ bind(&true_value); | 2145 __ bind(&true_value); |
| 2158 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2146 __ mov(ToRegister(instr->result()), factory()->true_value()); |
| 2159 __ bind(&done); | 2147 __ bind(&done); |
| 2160 } | 2148 } |
| 2161 | 2149 |
| 2162 | 2150 |
| 2163 void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) { | |
| 2164 Token::Value op = instr->op(); | |
| 2165 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
| 2166 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
| 2167 | |
| 2168 Handle<Code> ic = CompareIC::GetUninitialized(op); | |
| 2169 CallCode(ic, RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); | |
| 2170 | |
| 2171 // The compare stub expects compare condition and the input operands | |
| 2172 // reversed for GT and LTE. | |
| 2173 Condition condition = ComputeCompareCondition(op); | |
| 2174 if (op == Token::GT || op == Token::LTE) { | |
| 2175 condition = ReverseCondition(condition); | |
| 2176 } | |
| 2177 __ test(eax, Operand(eax)); | |
| 2178 EmitBranch(true_block, false_block, condition); | |
| 2179 } | |
| 2180 | |
| 2181 | |
| 2182 void LCodeGen::DoReturn(LReturn* instr) { | 2151 void LCodeGen::DoReturn(LReturn* instr) { |
| 2183 if (FLAG_trace) { | 2152 if (FLAG_trace) { |
| 2184 // Preserve the return value on the stack and rely on the runtime call | 2153 // Preserve the return value on the stack and rely on the runtime call |
| 2185 // to return the value in the same register. We're leaving the code | 2154 // to return the value in the same register. We're leaving the code |
| 2186 // managed by the register allocator and tearing down the frame, it's | 2155 // managed by the register allocator and tearing down the frame, it's |
| 2187 // safe to write to the context register. | 2156 // safe to write to the context register. |
| 2188 __ push(eax); | 2157 __ push(eax); |
| 2189 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2158 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2190 __ CallRuntime(Runtime::kTraceExit, 1); | 2159 __ CallRuntime(Runtime::kTraceExit, 1); |
| 2191 } | 2160 } |
| (...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4475 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4444 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 4476 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4445 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4477 } | 4446 } |
| 4478 | 4447 |
| 4479 | 4448 |
| 4480 #undef __ | 4449 #undef __ |
| 4481 | 4450 |
| 4482 } } // namespace v8::internal | 4451 } } // namespace v8::internal |
| 4483 | 4452 |
| 4484 #endif // V8_TARGET_ARCH_IA32 | 4453 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |