| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 3246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3257 &if_true, &if_false, &fall_through); | 3257 &if_true, &if_false, &fall_through); |
| 3258 | 3258 |
| 3259 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3259 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3260 __ test(eax, Immediate(kSmiTagMask | 0x80000000)); | 3260 __ test(eax, Immediate(kSmiTagMask | 0x80000000)); |
| 3261 Split(zero, if_true, if_false, fall_through); | 3261 Split(zero, if_true, if_false, fall_through); |
| 3262 | 3262 |
| 3263 context()->Plug(if_true, if_false); | 3263 context()->Plug(if_true, if_false); |
| 3264 } | 3264 } |
| 3265 | 3265 |
| 3266 | 3266 |
| 3267 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { | |
| 3268 ZoneList<Expression*>* args = expr->arguments(); | |
| 3269 DCHECK(args->length() == 1); | |
| 3270 | |
| 3271 VisitForAccumulatorValue(args->at(0)); | |
| 3272 | |
| 3273 Label materialize_true, materialize_false; | |
| 3274 Label* if_true = NULL; | |
| 3275 Label* if_false = NULL; | |
| 3276 Label* fall_through = NULL; | |
| 3277 context()->PrepareTest(&materialize_true, &materialize_false, | |
| 3278 &if_true, &if_false, &fall_through); | |
| 3279 | |
| 3280 __ JumpIfSmi(eax, if_false); | |
| 3281 __ cmp(eax, isolate()->factory()->null_value()); | |
| 3282 __ j(equal, if_true); | |
| 3283 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | |
| 3284 // Undetectable objects behave like undefined when tested with typeof. | |
| 3285 __ movzx_b(ecx, FieldOperand(ebx, Map::kBitFieldOffset)); | |
| 3286 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); | |
| 3287 __ j(not_zero, if_false); | |
| 3288 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | |
| 3289 __ cmp(ecx, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
| 3290 __ j(below, if_false); | |
| 3291 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
| 3292 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
| 3293 Split(below_equal, if_true, if_false, fall_through); | |
| 3294 | |
| 3295 context()->Plug(if_true, if_false); | |
| 3296 } | |
| 3297 | |
| 3298 | |
| 3299 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { | 3267 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { |
| 3300 ZoneList<Expression*>* args = expr->arguments(); | 3268 ZoneList<Expression*>* args = expr->arguments(); |
| 3301 DCHECK(args->length() == 1); | 3269 DCHECK(args->length() == 1); |
| 3302 | 3270 |
| 3303 VisitForAccumulatorValue(args->at(0)); | 3271 VisitForAccumulatorValue(args->at(0)); |
| 3304 | 3272 |
| 3305 Label materialize_true, materialize_false; | 3273 Label materialize_true, materialize_false; |
| 3306 Label* if_true = NULL; | 3274 Label* if_true = NULL; |
| 3307 Label* if_false = NULL; | 3275 Label* if_false = NULL; |
| 3308 Label* fall_through = NULL; | 3276 Label* fall_through = NULL; |
| (...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5291 Assembler::target_address_at(call_target_address, | 5259 Assembler::target_address_at(call_target_address, |
| 5292 unoptimized_code)); | 5260 unoptimized_code)); |
| 5293 return OSR_AFTER_STACK_CHECK; | 5261 return OSR_AFTER_STACK_CHECK; |
| 5294 } | 5262 } |
| 5295 | 5263 |
| 5296 | 5264 |
| 5297 } // namespace internal | 5265 } // namespace internal |
| 5298 } // namespace v8 | 5266 } // namespace v8 |
| 5299 | 5267 |
| 5300 #endif // V8_TARGET_ARCH_IA32 | 5268 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |