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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3249 &if_true, &if_false, &fall_through); | 3249 &if_true, &if_false, &fall_through); |
3250 | 3250 |
3251 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3251 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3252 Condition non_negative_smi = masm()->CheckNonNegativeSmi(rax); | 3252 Condition non_negative_smi = masm()->CheckNonNegativeSmi(rax); |
3253 Split(non_negative_smi, if_true, if_false, fall_through); | 3253 Split(non_negative_smi, if_true, if_false, fall_through); |
3254 | 3254 |
3255 context()->Plug(if_true, if_false); | 3255 context()->Plug(if_true, if_false); |
3256 } | 3256 } |
3257 | 3257 |
3258 | 3258 |
3259 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { | |
3260 ZoneList<Expression*>* args = expr->arguments(); | |
3261 DCHECK(args->length() == 1); | |
3262 | |
3263 VisitForAccumulatorValue(args->at(0)); | |
3264 | |
3265 Label materialize_true, materialize_false; | |
3266 Label* if_true = NULL; | |
3267 Label* if_false = NULL; | |
3268 Label* fall_through = NULL; | |
3269 context()->PrepareTest(&materialize_true, &materialize_false, | |
3270 &if_true, &if_false, &fall_through); | |
3271 | |
3272 __ JumpIfSmi(rax, if_false); | |
3273 __ CompareRoot(rax, Heap::kNullValueRootIndex); | |
3274 __ j(equal, if_true); | |
3275 __ movp(rbx, FieldOperand(rax, HeapObject::kMapOffset)); | |
3276 // Undetectable objects behave like undefined when tested with typeof. | |
3277 __ testb(FieldOperand(rbx, Map::kBitFieldOffset), | |
3278 Immediate(1 << Map::kIsUndetectable)); | |
3279 __ j(not_zero, if_false); | |
3280 __ movzxbp(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset)); | |
3281 __ cmpp(rbx, Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
3282 __ j(below, if_false); | |
3283 __ cmpp(rbx, Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
3284 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
3285 Split(below_equal, if_true, if_false, fall_through); | |
3286 | |
3287 context()->Plug(if_true, if_false); | |
3288 } | |
3289 | |
3290 | |
3291 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { | 3259 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { |
3292 ZoneList<Expression*>* args = expr->arguments(); | 3260 ZoneList<Expression*>* args = expr->arguments(); |
3293 DCHECK(args->length() == 1); | 3261 DCHECK(args->length() == 1); |
3294 | 3262 |
3295 VisitForAccumulatorValue(args->at(0)); | 3263 VisitForAccumulatorValue(args->at(0)); |
3296 | 3264 |
3297 Label materialize_true, materialize_false; | 3265 Label materialize_true, materialize_false; |
3298 Label* if_true = NULL; | 3266 Label* if_true = NULL; |
3299 Label* if_false = NULL; | 3267 Label* if_false = NULL; |
3300 Label* fall_through = NULL; | 3268 Label* fall_through = NULL; |
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5301 Assembler::target_address_at(call_target_address, | 5269 Assembler::target_address_at(call_target_address, |
5302 unoptimized_code)); | 5270 unoptimized_code)); |
5303 return OSR_AFTER_STACK_CHECK; | 5271 return OSR_AFTER_STACK_CHECK; |
5304 } | 5272 } |
5305 | 5273 |
5306 | 5274 |
5307 } // namespace internal | 5275 } // namespace internal |
5308 } // namespace v8 | 5276 } // namespace v8 |
5309 | 5277 |
5310 #endif // V8_TARGET_ARCH_X64 | 5278 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |