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 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2143 | 2143 |
2144 InstanceofStub stub(InstanceofStub::kArgsInRegisters); | 2144 InstanceofStub stub(InstanceofStub::kArgsInRegisters); |
2145 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2145 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
2146 | 2146 |
2147 __ cmp(r0, Operand(0)); | 2147 __ cmp(r0, Operand(0)); |
2148 __ mov(r0, Operand(factory()->false_value()), LeaveCC, ne); | 2148 __ mov(r0, Operand(factory()->false_value()), LeaveCC, ne); |
2149 __ mov(r0, Operand(factory()->true_value()), LeaveCC, eq); | 2149 __ mov(r0, Operand(factory()->true_value()), LeaveCC, eq); |
2150 } | 2150 } |
2151 | 2151 |
2152 | 2152 |
2153 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { | |
2154 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0. | |
2155 ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1. | |
2156 | |
2157 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
2158 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
2159 | |
2160 InstanceofStub stub(InstanceofStub::kArgsInRegisters); | |
2161 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | |
2162 __ cmp(r0, Operand(0)); | |
2163 EmitBranch(true_block, false_block, eq); | |
2164 } | |
2165 | |
2166 | |
2167 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2153 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
2168 class DeferredInstanceOfKnownGlobal: public LDeferredCode { | 2154 class DeferredInstanceOfKnownGlobal: public LDeferredCode { |
2169 public: | 2155 public: |
2170 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2156 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
2171 LInstanceOfKnownGlobal* instr) | 2157 LInstanceOfKnownGlobal* instr) |
2172 : LDeferredCode(codegen), instr_(instr) { } | 2158 : LDeferredCode(codegen), instr_(instr) { } |
2173 virtual void Generate() { | 2159 virtual void Generate() { |
2174 codegen()->DoDeferredLInstanceOfKnownGlobal(instr_, &map_check_); | 2160 codegen()->DoDeferredLInstanceOfKnownGlobal(instr_, &map_check_); |
2175 } | 2161 } |
2176 | 2162 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 } | 2297 } |
2312 __ LoadRoot(ToRegister(instr->result()), | 2298 __ LoadRoot(ToRegister(instr->result()), |
2313 Heap::kTrueValueRootIndex, | 2299 Heap::kTrueValueRootIndex, |
2314 condition); | 2300 condition); |
2315 __ LoadRoot(ToRegister(instr->result()), | 2301 __ LoadRoot(ToRegister(instr->result()), |
2316 Heap::kFalseValueRootIndex, | 2302 Heap::kFalseValueRootIndex, |
2317 NegateCondition(condition)); | 2303 NegateCondition(condition)); |
2318 } | 2304 } |
2319 | 2305 |
2320 | 2306 |
2321 void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) { | |
2322 Token::Value op = instr->op(); | |
2323 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
2324 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
2325 | |
2326 Handle<Code> ic = CompareIC::GetUninitialized(op); | |
2327 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
2328 | |
2329 // The compare stub expects compare condition and the input operands | |
2330 // reversed for GT and LTE. | |
2331 Condition condition = ComputeCompareCondition(op); | |
2332 if (op == Token::GT || op == Token::LTE) { | |
2333 condition = ReverseCondition(condition); | |
2334 } | |
2335 __ cmp(r0, Operand(0)); | |
2336 EmitBranch(true_block, false_block, condition); | |
2337 } | |
2338 | |
2339 | |
2340 void LCodeGen::DoReturn(LReturn* instr) { | 2307 void LCodeGen::DoReturn(LReturn* instr) { |
2341 if (FLAG_trace) { | 2308 if (FLAG_trace) { |
2342 // Push the return value on the stack as the parameter. | 2309 // Push the return value on the stack as the parameter. |
2343 // Runtime::TraceExit returns its parameter in r0. | 2310 // Runtime::TraceExit returns its parameter in r0. |
2344 __ push(r0); | 2311 __ push(r0); |
2345 __ CallRuntime(Runtime::kTraceExit, 1); | 2312 __ CallRuntime(Runtime::kTraceExit, 1); |
2346 } | 2313 } |
2347 int32_t sp_delta = (GetParameterCount() + 1) * kPointerSize; | 2314 int32_t sp_delta = (GetParameterCount() + 1) * kPointerSize; |
2348 __ mov(sp, fp); | 2315 __ mov(sp, fp); |
2349 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | 2316 __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4604 ASSERT(osr_pc_offset_ == -1); | 4571 ASSERT(osr_pc_offset_ == -1); |
4605 osr_pc_offset_ = masm()->pc_offset(); | 4572 osr_pc_offset_ = masm()->pc_offset(); |
4606 } | 4573 } |
4607 | 4574 |
4608 | 4575 |
4609 | 4576 |
4610 | 4577 |
4611 #undef __ | 4578 #undef __ |
4612 | 4579 |
4613 } } // namespace v8::internal | 4580 } } // namespace v8::internal |
OLD | NEW |