| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 6 | 6 |
| 7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
| 8 // | 8 // |
| 9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
| 10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
| (...skipping 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3313 | 3313 |
| 3314 __ JumpIfSmi(v0, if_false); | 3314 __ JumpIfSmi(v0, if_false); |
| 3315 __ GetObjectType(v0, a1, a1); | 3315 __ GetObjectType(v0, a1, a1); |
| 3316 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3316 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3317 Split(eq, a1, Operand(SIMD128_VALUE_TYPE), if_true, if_false, fall_through); | 3317 Split(eq, a1, Operand(SIMD128_VALUE_TYPE), if_true, if_false, fall_through); |
| 3318 | 3318 |
| 3319 context()->Plug(if_true, if_false); | 3319 context()->Plug(if_true, if_false); |
| 3320 } | 3320 } |
| 3321 | 3321 |
| 3322 | 3322 |
| 3323 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( | |
| 3324 CallRuntime* expr) { | |
| 3325 ZoneList<Expression*>* args = expr->arguments(); | |
| 3326 DCHECK(args->length() == 1); | |
| 3327 | |
| 3328 VisitForAccumulatorValue(args->at(0)); | |
| 3329 | |
| 3330 Label materialize_true, materialize_false, skip_lookup; | |
| 3331 Label* if_true = NULL; | |
| 3332 Label* if_false = NULL; | |
| 3333 Label* fall_through = NULL; | |
| 3334 context()->PrepareTest(&materialize_true, &materialize_false, | |
| 3335 &if_true, &if_false, &fall_through); | |
| 3336 | |
| 3337 __ AssertNotSmi(v0); | |
| 3338 | |
| 3339 __ ld(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); | |
| 3340 __ lbu(a4, FieldMemOperand(a1, Map::kBitField2Offset)); | |
| 3341 __ And(a4, a4, 1 << Map::kStringWrapperSafeForDefaultValueOf); | |
| 3342 __ Branch(&skip_lookup, ne, a4, Operand(zero_reg)); | |
| 3343 | |
| 3344 // Check for fast case object. Generate false result for slow case object. | |
| 3345 __ ld(a2, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | |
| 3346 __ ld(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); | |
| 3347 __ LoadRoot(a4, Heap::kHashTableMapRootIndex); | |
| 3348 __ Branch(if_false, eq, a2, Operand(a4)); | |
| 3349 | |
| 3350 // Look for valueOf name in the descriptor array, and indicate false if | |
| 3351 // found. Since we omit an enumeration index check, if it is added via a | |
| 3352 // transition that shares its descriptor array, this is a false positive. | |
| 3353 Label entry, loop, done; | |
| 3354 | |
| 3355 // Skip loop if no descriptors are valid. | |
| 3356 __ NumberOfOwnDescriptors(a3, a1); | |
| 3357 __ Branch(&done, eq, a3, Operand(zero_reg)); | |
| 3358 | |
| 3359 __ LoadInstanceDescriptors(a1, a4); | |
| 3360 // a4: descriptor array. | |
| 3361 // a3: valid entries in the descriptor array. | |
| 3362 STATIC_ASSERT(kSmiTag == 0); | |
| 3363 STATIC_ASSERT(kSmiTagSize == 1); | |
| 3364 // Does not need? | |
| 3365 // STATIC_ASSERT(kPointerSize == 4); | |
| 3366 __ li(at, Operand(DescriptorArray::kDescriptorSize)); | |
| 3367 __ Dmul(a3, a3, at); | |
| 3368 // Calculate location of the first key name. | |
| 3369 __ Daddu(a4, a4, Operand(DescriptorArray::kFirstOffset - kHeapObjectTag)); | |
| 3370 // Calculate the end of the descriptor array. | |
| 3371 __ mov(a2, a4); | |
| 3372 __ dsll(a5, a3, kPointerSizeLog2); | |
| 3373 __ Daddu(a2, a2, a5); | |
| 3374 | |
| 3375 // Loop through all the keys in the descriptor array. If one of these is the | |
| 3376 // string "valueOf" the result is false. | |
| 3377 // The use of a6 to store the valueOf string assumes that it is not otherwise | |
| 3378 // used in the loop below. | |
| 3379 __ LoadRoot(a6, Heap::kvalueOf_stringRootIndex); | |
| 3380 __ jmp(&entry); | |
| 3381 __ bind(&loop); | |
| 3382 __ ld(a3, MemOperand(a4, 0)); | |
| 3383 __ Branch(if_false, eq, a3, Operand(a6)); | |
| 3384 __ Daddu(a4, a4, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); | |
| 3385 __ bind(&entry); | |
| 3386 __ Branch(&loop, ne, a4, Operand(a2)); | |
| 3387 | |
| 3388 __ bind(&done); | |
| 3389 | |
| 3390 // Set the bit in the map to indicate that there is no local valueOf field. | |
| 3391 __ lbu(a2, FieldMemOperand(a1, Map::kBitField2Offset)); | |
| 3392 __ Or(a2, a2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | |
| 3393 __ sb(a2, FieldMemOperand(a1, Map::kBitField2Offset)); | |
| 3394 | |
| 3395 __ bind(&skip_lookup); | |
| 3396 | |
| 3397 // If a valueOf property is not found on the object check that its | |
| 3398 // prototype is the un-modified String prototype. If not result is false. | |
| 3399 __ ld(a2, FieldMemOperand(a1, Map::kPrototypeOffset)); | |
| 3400 __ JumpIfSmi(a2, if_false); | |
| 3401 __ ld(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); | |
| 3402 __ ld(a3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
| 3403 __ ld(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset)); | |
| 3404 __ ld(a3, ContextOperand(a3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | |
| 3405 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
| 3406 Split(eq, a2, Operand(a3), if_true, if_false, fall_through); | |
| 3407 | |
| 3408 context()->Plug(if_true, if_false); | |
| 3409 } | |
| 3410 | |
| 3411 | |
| 3412 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 3323 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
| 3413 ZoneList<Expression*>* args = expr->arguments(); | 3324 ZoneList<Expression*>* args = expr->arguments(); |
| 3414 DCHECK(args->length() == 1); | 3325 DCHECK(args->length() == 1); |
| 3415 | 3326 |
| 3416 VisitForAccumulatorValue(args->at(0)); | 3327 VisitForAccumulatorValue(args->at(0)); |
| 3417 | 3328 |
| 3418 Label materialize_true, materialize_false; | 3329 Label materialize_true, materialize_false; |
| 3419 Label* if_true = NULL; | 3330 Label* if_true = NULL; |
| 3420 Label* if_false = NULL; | 3331 Label* if_false = NULL; |
| 3421 Label* fall_through = NULL; | 3332 Label* fall_through = NULL; |
| (...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5343 reinterpret_cast<uint64_t>( | 5254 reinterpret_cast<uint64_t>( |
| 5344 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5255 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5345 return OSR_AFTER_STACK_CHECK; | 5256 return OSR_AFTER_STACK_CHECK; |
| 5346 } | 5257 } |
| 5347 | 5258 |
| 5348 | 5259 |
| 5349 } // namespace internal | 5260 } // namespace internal |
| 5350 } // namespace v8 | 5261 } // namespace v8 |
| 5351 | 5262 |
| 5352 #endif // V8_TARGET_ARCH_MIPS64 | 5263 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |