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 4128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4139 Split(cc, if_true, if_false, fall_through); | 4139 Split(cc, if_true, if_false, fall_through); |
4140 } | 4140 } |
4141 } | 4141 } |
4142 | 4142 |
4143 // Convert the result of the comparison into one expected for this | 4143 // Convert the result of the comparison into one expected for this |
4144 // expression's context. | 4144 // expression's context. |
4145 context()->Plug(if_true, if_false); | 4145 context()->Plug(if_true, if_false); |
4146 } | 4146 } |
4147 | 4147 |
4148 | 4148 |
4149 void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) { | 4149 void FullCodeGenerator::EmitLiteralCompareNull(Expression* expr, |
4150 Label materialize_true, materialize_false; | 4150 bool is_strict, |
4151 Label* if_true = NULL; | 4151 Label* if_true, |
4152 Label* if_false = NULL; | 4152 Label* if_false, |
4153 Label* fall_through = NULL; | 4153 Label* fall_through) { |
4154 context()->PrepareTest(&materialize_true, &materialize_false, | 4154 VisitForAccumulatorValue(expr); |
4155 &if_true, &if_false, &fall_through); | |
4156 | |
4157 VisitForAccumulatorValue(expr->expression()); | |
4158 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 4155 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
4159 | |
4160 __ cmp(eax, isolate()->factory()->null_value()); | 4156 __ cmp(eax, isolate()->factory()->null_value()); |
4161 if (expr->is_strict()) { | 4157 if (is_strict) { |
4162 Split(equal, if_true, if_false, fall_through); | 4158 Split(equal, if_true, if_false, fall_through); |
4163 } else { | 4159 } else { |
4164 __ j(equal, if_true); | 4160 __ j(equal, if_true); |
4165 __ cmp(eax, isolate()->factory()->undefined_value()); | 4161 __ cmp(eax, isolate()->factory()->undefined_value()); |
4166 __ j(equal, if_true); | 4162 __ j(equal, if_true); |
4167 __ JumpIfSmi(eax, if_false); | 4163 __ JumpIfSmi(eax, if_false); |
4168 // It can be an undetectable object. | 4164 // It can be an undetectable object. |
4169 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); | 4165 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); |
4170 __ movzx_b(edx, FieldOperand(edx, Map::kBitFieldOffset)); | 4166 __ movzx_b(edx, FieldOperand(edx, Map::kBitFieldOffset)); |
4171 __ test(edx, Immediate(1 << Map::kIsUndetectable)); | 4167 __ test(edx, Immediate(1 << Map::kIsUndetectable)); |
4172 Split(not_zero, if_true, if_false, fall_through); | 4168 Split(not_zero, if_true, if_false, fall_through); |
4173 } | 4169 } |
4174 context()->Plug(if_true, if_false); | |
4175 } | 4170 } |
4176 | 4171 |
4177 | 4172 |
4178 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 4173 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
4179 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 4174 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
4180 context()->Plug(eax); | 4175 context()->Plug(eax); |
4181 } | 4176 } |
4182 | 4177 |
4183 | 4178 |
4184 Register FullCodeGenerator::result_register() { | 4179 Register FullCodeGenerator::result_register() { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4276 *context_length = 0; | 4271 *context_length = 0; |
4277 return previous_; | 4272 return previous_; |
4278 } | 4273 } |
4279 | 4274 |
4280 | 4275 |
4281 #undef __ | 4276 #undef __ |
4282 | 4277 |
4283 } } // namespace v8::internal | 4278 } } // namespace v8::internal |
4284 | 4279 |
4285 #endif // V8_TARGET_ARCH_IA32 | 4280 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |