| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 3307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3318 | 3318 |
| 3319 __ JumpIfSmi(r0, if_false); | 3319 __ JumpIfSmi(r0, if_false); |
| 3320 __ CompareObjectType(r0, r1, r1, SIMD128_VALUE_TYPE); | 3320 __ CompareObjectType(r0, r1, r1, SIMD128_VALUE_TYPE); |
| 3321 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3321 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3322 Split(eq, if_true, if_false, fall_through); | 3322 Split(eq, if_true, if_false, fall_through); |
| 3323 | 3323 |
| 3324 context()->Plug(if_true, if_false); | 3324 context()->Plug(if_true, if_false); |
| 3325 } | 3325 } |
| 3326 | 3326 |
| 3327 | 3327 |
| 3328 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( | |
| 3329 CallRuntime* expr) { | |
| 3330 ZoneList<Expression*>* args = expr->arguments(); | |
| 3331 DCHECK(args->length() == 1); | |
| 3332 | |
| 3333 VisitForAccumulatorValue(args->at(0)); | |
| 3334 | |
| 3335 Label materialize_true, materialize_false, skip_lookup; | |
| 3336 Label* if_true = NULL; | |
| 3337 Label* if_false = NULL; | |
| 3338 Label* fall_through = NULL; | |
| 3339 context()->PrepareTest(&materialize_true, &materialize_false, | |
| 3340 &if_true, &if_false, &fall_through); | |
| 3341 | |
| 3342 __ AssertNotSmi(r0); | |
| 3343 | |
| 3344 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | |
| 3345 __ ldrb(ip, FieldMemOperand(r1, Map::kBitField2Offset)); | |
| 3346 __ tst(ip, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | |
| 3347 __ b(ne, &skip_lookup); | |
| 3348 | |
| 3349 // Check for fast case object. Generate false result for slow case object. | |
| 3350 __ ldr(r2, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | |
| 3351 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); | |
| 3352 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); | |
| 3353 __ cmp(r2, ip); | |
| 3354 __ b(eq, if_false); | |
| 3355 | |
| 3356 // Look for valueOf name in the descriptor array, and indicate false if | |
| 3357 // found. Since we omit an enumeration index check, if it is added via a | |
| 3358 // transition that shares its descriptor array, this is a false positive. | |
| 3359 Label entry, loop, done; | |
| 3360 | |
| 3361 // Skip loop if no descriptors are valid. | |
| 3362 __ NumberOfOwnDescriptors(r3, r1); | |
| 3363 __ cmp(r3, Operand::Zero()); | |
| 3364 __ b(eq, &done); | |
| 3365 | |
| 3366 __ LoadInstanceDescriptors(r1, r4); | |
| 3367 // r4: descriptor array. | |
| 3368 // r3: valid entries in the descriptor array. | |
| 3369 __ mov(ip, Operand(DescriptorArray::kDescriptorSize)); | |
| 3370 __ mul(r3, r3, ip); | |
| 3371 // Calculate location of the first key name. | |
| 3372 __ add(r4, r4, Operand(DescriptorArray::kFirstOffset - kHeapObjectTag)); | |
| 3373 // Calculate the end of the descriptor array. | |
| 3374 __ mov(r2, r4); | |
| 3375 __ add(r2, r2, Operand(r3, LSL, kPointerSizeLog2)); | |
| 3376 | |
| 3377 // Loop through all the keys in the descriptor array. If one of these is the | |
| 3378 // string "valueOf" the result is false. | |
| 3379 // The use of ip to store the valueOf string assumes that it is not otherwise | |
| 3380 // used in the loop below. | |
| 3381 __ LoadRoot(ip, Heap::kvalueOf_stringRootIndex); | |
| 3382 __ jmp(&entry); | |
| 3383 __ bind(&loop); | |
| 3384 __ ldr(r3, MemOperand(r4, 0)); | |
| 3385 __ cmp(r3, ip); | |
| 3386 __ b(eq, if_false); | |
| 3387 __ add(r4, r4, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); | |
| 3388 __ bind(&entry); | |
| 3389 __ cmp(r4, Operand(r2)); | |
| 3390 __ b(ne, &loop); | |
| 3391 | |
| 3392 __ bind(&done); | |
| 3393 | |
| 3394 // Set the bit in the map to indicate that there is no local valueOf field. | |
| 3395 __ ldrb(r2, FieldMemOperand(r1, Map::kBitField2Offset)); | |
| 3396 __ orr(r2, r2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | |
| 3397 __ strb(r2, FieldMemOperand(r1, Map::kBitField2Offset)); | |
| 3398 | |
| 3399 __ bind(&skip_lookup); | |
| 3400 | |
| 3401 // If a valueOf property is not found on the object check that its | |
| 3402 // prototype is the un-modified String prototype. If not result is false. | |
| 3403 __ ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset)); | |
| 3404 __ JumpIfSmi(r2, if_false); | |
| 3405 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); | |
| 3406 __ ldr(r3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
| 3407 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); | |
| 3408 __ ldr(r3, ContextOperand(r3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | |
| 3409 __ cmp(r2, r3); | |
| 3410 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
| 3411 Split(eq, if_true, if_false, fall_through); | |
| 3412 | |
| 3413 context()->Plug(if_true, if_false); | |
| 3414 } | |
| 3415 | |
| 3416 | |
| 3417 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 3328 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
| 3418 ZoneList<Expression*>* args = expr->arguments(); | 3329 ZoneList<Expression*>* args = expr->arguments(); |
| 3419 DCHECK(args->length() == 1); | 3330 DCHECK(args->length() == 1); |
| 3420 | 3331 |
| 3421 VisitForAccumulatorValue(args->at(0)); | 3332 VisitForAccumulatorValue(args->at(0)); |
| 3422 | 3333 |
| 3423 Label materialize_true, materialize_false; | 3334 Label materialize_true, materialize_false; |
| 3424 Label* if_true = NULL; | 3335 Label* if_true = NULL; |
| 3425 Label* if_false = NULL; | 3336 Label* if_false = NULL; |
| 3426 Label* fall_through = NULL; | 3337 Label* fall_through = NULL; |
| (...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5366 DCHECK(interrupt_address == | 5277 DCHECK(interrupt_address == |
| 5367 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5278 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5368 return OSR_AFTER_STACK_CHECK; | 5279 return OSR_AFTER_STACK_CHECK; |
| 5369 } | 5280 } |
| 5370 | 5281 |
| 5371 | 5282 |
| 5372 } // namespace internal | 5283 } // namespace internal |
| 5373 } // namespace v8 | 5284 } // namespace v8 |
| 5374 | 5285 |
| 5375 #endif // V8_TARGET_ARCH_ARM | 5286 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |