OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2781 __ Branch(if_false, eq, a3, Operand(t2)); | 2781 __ Branch(if_false, eq, a3, Operand(t2)); |
2782 __ Addu(t0, t0, Operand(kPointerSize)); | 2782 __ Addu(t0, t0, Operand(kPointerSize)); |
2783 __ bind(&entry); | 2783 __ bind(&entry); |
2784 __ Branch(&loop, ne, t0, Operand(a2)); | 2784 __ Branch(&loop, ne, t0, Operand(a2)); |
2785 | 2785 |
2786 // If a valueOf property is not found on the object check that it's | 2786 // If a valueOf property is not found on the object check that it's |
2787 // prototype is the un-modified String prototype. If not result is false. | 2787 // prototype is the un-modified String prototype. If not result is false. |
2788 __ lw(a2, FieldMemOperand(a1, Map::kPrototypeOffset)); | 2788 __ lw(a2, FieldMemOperand(a1, Map::kPrototypeOffset)); |
2789 __ JumpIfSmi(a2, if_false); | 2789 __ JumpIfSmi(a2, if_false); |
2790 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); | 2790 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); |
2791 __ lw(a3, ContextOperand(cp, Context::GLOBAL_INDEX)); | 2791 __ lw(a3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
2792 __ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset)); | 2792 __ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset)); |
2793 __ lw(a3, ContextOperand(a3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | 2793 __ lw(a3, ContextOperand(a3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); |
2794 __ Branch(if_false, ne, a2, Operand(a3)); | 2794 __ Branch(if_false, ne, a2, Operand(a3)); |
2795 | 2795 |
2796 // Set the bit in the map to indicate that it has been checked safe for | 2796 // Set the bit in the map to indicate that it has been checked safe for |
2797 // default valueOf and set true result. | 2797 // default valueOf and set true result. |
2798 __ lbu(a2, FieldMemOperand(a1, Map::kBitField2Offset)); | 2798 __ lbu(a2, FieldMemOperand(a1, Map::kBitField2Offset)); |
2799 __ Or(a2, a2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 2799 __ Or(a2, a2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
2800 __ sb(a2, FieldMemOperand(a1, Map::kBitField2Offset)); | 2800 __ sb(a2, FieldMemOperand(a1, Map::kBitField2Offset)); |
2801 __ jmp(if_true); | 2801 __ jmp(if_true); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 __ CallRuntime(Runtime::kNumberAlloc, 0); | 3062 __ CallRuntime(Runtime::kNumberAlloc, 0); |
3063 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call. | 3063 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call. |
3064 | 3064 |
3065 __ bind(&heapnumber_allocated); | 3065 __ bind(&heapnumber_allocated); |
3066 | 3066 |
3067 // Convert 32 random bits in v0 to 0.(32 random bits) in a double | 3067 // Convert 32 random bits in v0 to 0.(32 random bits) in a double |
3068 // by computing: | 3068 // by computing: |
3069 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 3069 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
3070 if (CpuFeatures::IsSupported(FPU)) { | 3070 if (CpuFeatures::IsSupported(FPU)) { |
3071 __ PrepareCallCFunction(1, a0); | 3071 __ PrepareCallCFunction(1, a0); |
3072 __ lw(a0, ContextOperand(cp, Context::GLOBAL_INDEX)); | 3072 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
3073 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); | 3073 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); |
3074 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 3074 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
3075 | 3075 |
3076 CpuFeatures::Scope scope(FPU); | 3076 CpuFeatures::Scope scope(FPU); |
3077 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 3077 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
3078 __ li(a1, Operand(0x41300000)); | 3078 __ li(a1, Operand(0x41300000)); |
3079 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. | 3079 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. |
3080 __ Move(f12, v0, a1); | 3080 __ Move(f12, v0, a1); |
3081 // Move 0x4130000000000000 to FPU. | 3081 // Move 0x4130000000000000 to FPU. |
3082 __ Move(f14, zero_reg, a1); | 3082 __ Move(f14, zero_reg, a1); |
3083 // Subtract and store the result in the heap number. | 3083 // Subtract and store the result in the heap number. |
3084 __ sub_d(f0, f12, f14); | 3084 __ sub_d(f0, f12, f14); |
3085 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset)); | 3085 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset)); |
3086 __ mov(v0, s0); | 3086 __ mov(v0, s0); |
3087 } else { | 3087 } else { |
3088 __ PrepareCallCFunction(2, a0); | 3088 __ PrepareCallCFunction(2, a0); |
3089 __ mov(a0, s0); | 3089 __ mov(a0, s0); |
3090 __ lw(a1, ContextOperand(cp, Context::GLOBAL_INDEX)); | 3090 __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
3091 __ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset)); | 3091 __ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset)); |
3092 __ CallCFunction( | 3092 __ CallCFunction( |
3093 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); | 3093 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); |
3094 } | 3094 } |
3095 | 3095 |
3096 context()->Plug(v0); | 3096 context()->Plug(v0); |
3097 } | 3097 } |
3098 | 3098 |
3099 | 3099 |
3100 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { | 3100 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3508 __ Abort("Attempt to use undefined cache."); | 3508 __ Abort("Attempt to use undefined cache."); |
3509 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 3509 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
3510 context()->Plug(v0); | 3510 context()->Plug(v0); |
3511 return; | 3511 return; |
3512 } | 3512 } |
3513 | 3513 |
3514 VisitForAccumulatorValue(args->at(1)); | 3514 VisitForAccumulatorValue(args->at(1)); |
3515 | 3515 |
3516 Register key = v0; | 3516 Register key = v0; |
3517 Register cache = a1; | 3517 Register cache = a1; |
3518 __ lw(cache, ContextOperand(cp, Context::GLOBAL_INDEX)); | 3518 __ lw(cache, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
3519 __ lw(cache, FieldMemOperand(cache, GlobalObject::kNativeContextOffset)); | 3519 __ lw(cache, FieldMemOperand(cache, GlobalObject::kNativeContextOffset)); |
3520 __ lw(cache, | 3520 __ lw(cache, |
3521 ContextOperand( | 3521 ContextOperand( |
3522 cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); | 3522 cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); |
3523 __ lw(cache, | 3523 __ lw(cache, |
3524 FieldMemOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); | 3524 FieldMemOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); |
3525 | 3525 |
3526 | 3526 |
3527 Label done, not_found; | 3527 Label done, not_found; |
3528 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | 3528 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4611 *context_length = 0; | 4611 *context_length = 0; |
4612 return previous_; | 4612 return previous_; |
4613 } | 4613 } |
4614 | 4614 |
4615 | 4615 |
4616 #undef __ | 4616 #undef __ |
4617 | 4617 |
4618 } } // namespace v8::internal | 4618 } } // namespace v8::internal |
4619 | 4619 |
4620 #endif // V8_TARGET_ARCH_MIPS | 4620 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |