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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 &if_true, &if_false, &fall_through); | 3248 &if_true, &if_false, &fall_through); |
3249 | 3249 |
3250 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3250 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3251 __ test(eax, Immediate(kSmiTagMask | 0x80000000)); | 3251 __ test(eax, Immediate(kSmiTagMask | 0x80000000)); |
3252 Split(zero, if_true, if_false, fall_through); | 3252 Split(zero, if_true, if_false, fall_through); |
3253 | 3253 |
3254 context()->Plug(if_true, if_false); | 3254 context()->Plug(if_true, if_false); |
3255 } | 3255 } |
3256 | 3256 |
3257 | 3257 |
3258 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { | |
3259 ZoneList<Expression*>* args = expr->arguments(); | |
3260 DCHECK(args->length() == 1); | |
3261 | |
3262 VisitForAccumulatorValue(args->at(0)); | |
3263 | |
3264 Label materialize_true, materialize_false; | |
3265 Label* if_true = NULL; | |
3266 Label* if_false = NULL; | |
3267 Label* fall_through = NULL; | |
3268 context()->PrepareTest(&materialize_true, &materialize_false, | |
3269 &if_true, &if_false, &fall_through); | |
3270 | |
3271 __ JumpIfSmi(eax, if_false); | |
3272 __ cmp(eax, isolate()->factory()->null_value()); | |
3273 __ j(equal, if_true); | |
3274 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | |
3275 // Undetectable objects behave like undefined when tested with typeof. | |
3276 __ movzx_b(ecx, FieldOperand(ebx, Map::kBitFieldOffset)); | |
3277 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); | |
3278 __ j(not_zero, if_false); | |
3279 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | |
3280 __ cmp(ecx, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
3281 __ j(below, if_false); | |
3282 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
3283 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
3284 Split(below_equal, if_true, if_false, fall_through); | |
3285 | |
3286 context()->Plug(if_true, if_false); | |
3287 } | |
3288 | |
3289 | |
3290 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { | 3258 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { |
3291 ZoneList<Expression*>* args = expr->arguments(); | 3259 ZoneList<Expression*>* args = expr->arguments(); |
3292 DCHECK(args->length() == 1); | 3260 DCHECK(args->length() == 1); |
3293 | 3261 |
3294 VisitForAccumulatorValue(args->at(0)); | 3262 VisitForAccumulatorValue(args->at(0)); |
3295 | 3263 |
3296 Label materialize_true, materialize_false; | 3264 Label materialize_true, materialize_false; |
3297 Label* if_true = NULL; | 3265 Label* if_true = NULL; |
3298 Label* if_false = NULL; | 3266 Label* if_false = NULL; |
3299 Label* fall_through = NULL; | 3267 Label* fall_through = NULL; |
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5282 Assembler::target_address_at(call_target_address, | 5250 Assembler::target_address_at(call_target_address, |
5283 unoptimized_code)); | 5251 unoptimized_code)); |
5284 return OSR_AFTER_STACK_CHECK; | 5252 return OSR_AFTER_STACK_CHECK; |
5285 } | 5253 } |
5286 | 5254 |
5287 | 5255 |
5288 } // namespace internal | 5256 } // namespace internal |
5289 } // namespace v8 | 5257 } // namespace v8 |
5290 | 5258 |
5291 #endif // V8_TARGET_ARCH_X87 | 5259 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |