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 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 __ testq(rax, rax); | 2007 __ testq(rax, rax); |
2008 __ j(zero, &true_value, Label::kNear); | 2008 __ j(zero, &true_value, Label::kNear); |
2009 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); | 2009 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); |
2010 __ jmp(&done, Label::kNear); | 2010 __ jmp(&done, Label::kNear); |
2011 __ bind(&true_value); | 2011 __ bind(&true_value); |
2012 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); | 2012 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); |
2013 __ bind(&done); | 2013 __ bind(&done); |
2014 } | 2014 } |
2015 | 2015 |
2016 | 2016 |
2017 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { | |
2018 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
2019 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
2020 | |
2021 InstanceofStub stub(InstanceofStub::kNoFlags); | |
2022 __ push(ToRegister(instr->InputAt(0))); | |
2023 __ push(ToRegister(instr->InputAt(1))); | |
2024 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | |
2025 __ testq(rax, rax); | |
2026 EmitBranch(true_block, false_block, zero); | |
2027 } | |
2028 | |
2029 | |
2030 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2017 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
2031 class DeferredInstanceOfKnownGlobal: public LDeferredCode { | 2018 class DeferredInstanceOfKnownGlobal: public LDeferredCode { |
2032 public: | 2019 public: |
2033 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2020 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
2034 LInstanceOfKnownGlobal* instr) | 2021 LInstanceOfKnownGlobal* instr) |
2035 : LDeferredCode(codegen), instr_(instr) { } | 2022 : LDeferredCode(codegen), instr_(instr) { } |
2036 virtual void Generate() { | 2023 virtual void Generate() { |
2037 codegen()->DoDeferredLInstanceOfKnownGlobal(instr_, &map_check_); | 2024 codegen()->DoDeferredLInstanceOfKnownGlobal(instr_, &map_check_); |
2038 } | 2025 } |
2039 | 2026 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 __ testq(rax, rax); | 2138 __ testq(rax, rax); |
2152 __ j(condition, &true_value, Label::kNear); | 2139 __ j(condition, &true_value, Label::kNear); |
2153 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); | 2140 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); |
2154 __ jmp(&done, Label::kNear); | 2141 __ jmp(&done, Label::kNear); |
2155 __ bind(&true_value); | 2142 __ bind(&true_value); |
2156 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); | 2143 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); |
2157 __ bind(&done); | 2144 __ bind(&done); |
2158 } | 2145 } |
2159 | 2146 |
2160 | 2147 |
2161 void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) { | |
2162 Token::Value op = instr->op(); | |
2163 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
2164 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
2165 | |
2166 Handle<Code> ic = CompareIC::GetUninitialized(op); | |
2167 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
2168 | |
2169 // The compare stub expects compare condition and the input operands | |
2170 // reversed for GT and LTE. | |
2171 Condition condition = TokenToCondition(op, false); | |
2172 if (op == Token::GT || op == Token::LTE) { | |
2173 condition = ReverseCondition(condition); | |
2174 } | |
2175 __ testq(rax, rax); | |
2176 EmitBranch(true_block, false_block, condition); | |
2177 } | |
2178 | |
2179 | |
2180 void LCodeGen::DoReturn(LReturn* instr) { | 2148 void LCodeGen::DoReturn(LReturn* instr) { |
2181 if (FLAG_trace) { | 2149 if (FLAG_trace) { |
2182 // Preserve the return value on the stack and rely on the runtime | 2150 // Preserve the return value on the stack and rely on the runtime |
2183 // call to return the value in the same register. | 2151 // call to return the value in the same register. |
2184 __ push(rax); | 2152 __ push(rax); |
2185 __ CallRuntime(Runtime::kTraceExit, 1); | 2153 __ CallRuntime(Runtime::kTraceExit, 1); |
2186 } | 2154 } |
2187 __ movq(rsp, rbp); | 2155 __ movq(rsp, rbp); |
2188 __ pop(rbp); | 2156 __ pop(rbp); |
2189 __ Ret((GetParameterCount() + 1) * kPointerSize, rcx); | 2157 __ Ret((GetParameterCount() + 1) * kPointerSize, rcx); |
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4285 RegisterEnvironmentForDeoptimization(environment); | 4253 RegisterEnvironmentForDeoptimization(environment); |
4286 ASSERT(osr_pc_offset_ == -1); | 4254 ASSERT(osr_pc_offset_ == -1); |
4287 osr_pc_offset_ = masm()->pc_offset(); | 4255 osr_pc_offset_ = masm()->pc_offset(); |
4288 } | 4256 } |
4289 | 4257 |
4290 #undef __ | 4258 #undef __ |
4291 | 4259 |
4292 } } // namespace v8::internal | 4260 } } // namespace v8::internal |
4293 | 4261 |
4294 #endif // V8_TARGET_ARCH_X64 | 4262 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |