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 3332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3343 VisitForStackValue(args->at(2)); | 3343 VisitForStackValue(args->at(2)); |
3344 __ CallRuntime(Runtime::kLog, 2); | 3344 __ CallRuntime(Runtime::kLog, 2); |
3345 } | 3345 } |
3346 | 3346 |
3347 // Finally, we're expected to leave a value on the top of the stack. | 3347 // Finally, we're expected to leave a value on the top of the stack. |
3348 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 3348 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
3349 context()->Plug(v0); | 3349 context()->Plug(v0); |
3350 } | 3350 } |
3351 | 3351 |
3352 | 3352 |
3353 void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) { | |
3354 ASSERT(expr->arguments()->length() == 0); | |
3355 Label slow_allocate_heapnumber; | |
3356 Label heapnumber_allocated; | |
3357 | |
3358 // Save the new heap number in callee-saved register s0, since | |
3359 // we call out to external C code below. | |
3360 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); | |
3361 __ AllocateHeapNumber(s0, a1, a2, t6, &slow_allocate_heapnumber); | |
3362 __ jmp(&heapnumber_allocated); | |
3363 | |
3364 __ bind(&slow_allocate_heapnumber); | |
3365 | |
3366 // Allocate a heap number. | |
3367 __ CallRuntime(Runtime::kNumberAlloc, 0); | |
3368 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call. | |
3369 | |
3370 __ bind(&heapnumber_allocated); | |
3371 | |
3372 // Convert 32 random bits in v0 to 0.(32 random bits) in a double | |
3373 // by computing: | |
3374 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | |
3375 __ PrepareCallCFunction(1, a0); | |
3376 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
3377 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); | |
3378 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | |
3379 | |
3380 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | |
3381 __ li(a1, Operand(0x41300000)); | |
3382 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. | |
3383 __ Move(f12, v0, a1); | |
3384 // Move 0x4130000000000000 to FPU. | |
3385 __ Move(f14, zero_reg, a1); | |
3386 // Subtract and store the result in the heap number. | |
3387 __ sub_d(f0, f12, f14); | |
3388 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset)); | |
3389 __ mov(v0, s0); | |
3390 | |
3391 context()->Plug(v0); | |
3392 } | |
3393 | |
3394 | |
3395 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { | 3353 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { |
3396 // Load the arguments on the stack and call the stub. | 3354 // Load the arguments on the stack and call the stub. |
3397 SubStringStub stub; | 3355 SubStringStub stub; |
3398 ZoneList<Expression*>* args = expr->arguments(); | 3356 ZoneList<Expression*>* args = expr->arguments(); |
3399 ASSERT(args->length() == 3); | 3357 ASSERT(args->length() == 3); |
3400 VisitForStackValue(args->at(0)); | 3358 VisitForStackValue(args->at(0)); |
3401 VisitForStackValue(args->at(1)); | 3359 VisitForStackValue(args->at(1)); |
3402 VisitForStackValue(args->at(2)); | 3360 VisitForStackValue(args->at(2)); |
3403 __ CallStub(&stub); | 3361 __ CallStub(&stub); |
3404 context()->Plug(v0); | 3362 context()->Plug(v0); |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5016 Assembler::target_address_at(pc_immediate_load_address)) == | 4974 Assembler::target_address_at(pc_immediate_load_address)) == |
5017 reinterpret_cast<uint32_t>( | 4975 reinterpret_cast<uint32_t>( |
5018 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4976 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5019 return OSR_AFTER_STACK_CHECK; | 4977 return OSR_AFTER_STACK_CHECK; |
5020 } | 4978 } |
5021 | 4979 |
5022 | 4980 |
5023 } } // namespace v8::internal | 4981 } } // namespace v8::internal |
5024 | 4982 |
5025 #endif // V8_TARGET_ARCH_MIPS | 4983 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |