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