OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 3298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3309 | 3309 |
3310 __ JumpIfSmi(r3, if_false); | 3310 __ JumpIfSmi(r3, if_false); |
3311 __ CompareObjectType(r3, r4, r4, SIMD128_VALUE_TYPE); | 3311 __ CompareObjectType(r3, r4, r4, SIMD128_VALUE_TYPE); |
3312 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3312 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3313 Split(eq, if_true, if_false, fall_through); | 3313 Split(eq, if_true, if_false, fall_through); |
3314 | 3314 |
3315 context()->Plug(if_true, if_false); | 3315 context()->Plug(if_true, if_false); |
3316 } | 3316 } |
3317 | 3317 |
3318 | 3318 |
3319 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( | |
3320 CallRuntime* expr) { | |
3321 ZoneList<Expression*>* args = expr->arguments(); | |
3322 DCHECK(args->length() == 1); | |
3323 | |
3324 VisitForAccumulatorValue(args->at(0)); | |
3325 | |
3326 Label materialize_true, materialize_false, skip_lookup; | |
3327 Label* if_true = NULL; | |
3328 Label* if_false = NULL; | |
3329 Label* fall_through = NULL; | |
3330 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | |
3331 &if_false, &fall_through); | |
3332 | |
3333 __ AssertNotSmi(r3); | |
3334 | |
3335 __ LoadP(r4, FieldMemOperand(r3, HeapObject::kMapOffset)); | |
3336 __ lbz(ip, FieldMemOperand(r4, Map::kBitField2Offset)); | |
3337 __ andi(r0, ip, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | |
3338 __ bne(&skip_lookup, cr0); | |
3339 | |
3340 // Check for fast case object. Generate false result for slow case object. | |
3341 __ LoadP(r5, FieldMemOperand(r3, JSObject::kPropertiesOffset)); | |
3342 __ LoadP(r5, FieldMemOperand(r5, HeapObject::kMapOffset)); | |
3343 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); | |
3344 __ cmp(r5, ip); | |
3345 __ beq(if_false); | |
3346 | |
3347 // Look for valueOf name in the descriptor array, and indicate false if | |
3348 // found. Since we omit an enumeration index check, if it is added via a | |
3349 // transition that shares its descriptor array, this is a false positive. | |
3350 Label entry, loop, done; | |
3351 | |
3352 // Skip loop if no descriptors are valid. | |
3353 __ NumberOfOwnDescriptors(r6, r4); | |
3354 __ cmpi(r6, Operand::Zero()); | |
3355 __ beq(&done); | |
3356 | |
3357 __ LoadInstanceDescriptors(r4, r7); | |
3358 // r7: descriptor array. | |
3359 // r6: valid entries in the descriptor array. | |
3360 __ mov(ip, Operand(DescriptorArray::kDescriptorSize)); | |
3361 __ Mul(r6, r6, ip); | |
3362 // Calculate location of the first key name. | |
3363 __ addi(r7, r7, Operand(DescriptorArray::kFirstOffset - kHeapObjectTag)); | |
3364 // Calculate the end of the descriptor array. | |
3365 __ mr(r5, r7); | |
3366 __ ShiftLeftImm(ip, r6, Operand(kPointerSizeLog2)); | |
3367 __ add(r5, r5, ip); | |
3368 | |
3369 // Loop through all the keys in the descriptor array. If one of these is the | |
3370 // string "valueOf" the result is false. | |
3371 // The use of ip to store the valueOf string assumes that it is not otherwise | |
3372 // used in the loop below. | |
3373 __ LoadRoot(ip, Heap::kvalueOf_stringRootIndex); | |
3374 __ b(&entry); | |
3375 __ bind(&loop); | |
3376 __ LoadP(r6, MemOperand(r7, 0)); | |
3377 __ cmp(r6, ip); | |
3378 __ beq(if_false); | |
3379 __ addi(r7, r7, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); | |
3380 __ bind(&entry); | |
3381 __ cmp(r7, r5); | |
3382 __ bne(&loop); | |
3383 | |
3384 __ bind(&done); | |
3385 | |
3386 // Set the bit in the map to indicate that there is no local valueOf field. | |
3387 __ lbz(r5, FieldMemOperand(r4, Map::kBitField2Offset)); | |
3388 __ ori(r5, r5, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | |
3389 __ stb(r5, FieldMemOperand(r4, Map::kBitField2Offset)); | |
3390 | |
3391 __ bind(&skip_lookup); | |
3392 | |
3393 // If a valueOf property is not found on the object check that its | |
3394 // prototype is the un-modified String prototype. If not result is false. | |
3395 __ LoadP(r5, FieldMemOperand(r4, Map::kPrototypeOffset)); | |
3396 __ JumpIfSmi(r5, if_false); | |
3397 __ LoadP(r5, FieldMemOperand(r5, HeapObject::kMapOffset)); | |
3398 __ LoadP(r6, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
3399 __ LoadP(r6, FieldMemOperand(r6, GlobalObject::kNativeContextOffset)); | |
3400 __ LoadP(r6, | |
3401 ContextOperand(r6, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | |
3402 __ cmp(r5, r6); | |
3403 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
3404 Split(eq, if_true, if_false, fall_through); | |
3405 | |
3406 context()->Plug(if_true, if_false); | |
3407 } | |
3408 | |
3409 | |
3410 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 3319 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
3411 ZoneList<Expression*>* args = expr->arguments(); | 3320 ZoneList<Expression*>* args = expr->arguments(); |
3412 DCHECK(args->length() == 1); | 3321 DCHECK(args->length() == 1); |
3413 | 3322 |
3414 VisitForAccumulatorValue(args->at(0)); | 3323 VisitForAccumulatorValue(args->at(0)); |
3415 | 3324 |
3416 Label materialize_true, materialize_false; | 3325 Label materialize_true, materialize_false; |
3417 Label* if_true = NULL; | 3326 Label* if_true = NULL; |
3418 Label* if_false = NULL; | 3327 Label* if_false = NULL; |
3419 Label* fall_through = NULL; | 3328 Label* fall_through = NULL; |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5315 return ON_STACK_REPLACEMENT; | 5224 return ON_STACK_REPLACEMENT; |
5316 } | 5225 } |
5317 | 5226 |
5318 DCHECK(interrupt_address == | 5227 DCHECK(interrupt_address == |
5319 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5228 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5320 return OSR_AFTER_STACK_CHECK; | 5229 return OSR_AFTER_STACK_CHECK; |
5321 } | 5230 } |
5322 } // namespace internal | 5231 } // namespace internal |
5323 } // namespace v8 | 5232 } // namespace v8 |
5324 #endif // V8_TARGET_ARCH_PPC | 5233 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |