| 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 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3316 VisitForStackValue(args->at(2)); | 3316 VisitForStackValue(args->at(2)); |
| 3317 __ CallRuntime(Runtime::kLog, 2); | 3317 __ CallRuntime(Runtime::kLog, 2); |
| 3318 } | 3318 } |
| 3319 | 3319 |
| 3320 // Finally, we're expected to leave a value on the top of the stack. | 3320 // Finally, we're expected to leave a value on the top of the stack. |
| 3321 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 3321 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 3322 context()->Plug(r0); | 3322 context()->Plug(r0); |
| 3323 } | 3323 } |
| 3324 | 3324 |
| 3325 | 3325 |
| 3326 void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) { | |
| 3327 ASSERT(expr->arguments()->length() == 0); | |
| 3328 Label slow_allocate_heapnumber; | |
| 3329 Label heapnumber_allocated; | |
| 3330 | |
| 3331 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); | |
| 3332 __ AllocateHeapNumber(r4, r1, r2, r6, &slow_allocate_heapnumber); | |
| 3333 __ jmp(&heapnumber_allocated); | |
| 3334 | |
| 3335 __ bind(&slow_allocate_heapnumber); | |
| 3336 // Allocate a heap number. | |
| 3337 __ CallRuntime(Runtime::kNumberAlloc, 0); | |
| 3338 __ mov(r4, Operand(r0)); | |
| 3339 | |
| 3340 __ bind(&heapnumber_allocated); | |
| 3341 | |
| 3342 // Convert 32 random bits in r0 to 0.(32 random bits) in a double | |
| 3343 // by computing: | |
| 3344 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | |
| 3345 __ PrepareCallCFunction(1, r0); | |
| 3346 __ ldr(r0, | |
| 3347 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); | |
| 3348 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset)); | |
| 3349 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | |
| 3350 | |
| 3351 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | |
| 3352 // Create this constant using mov/orr to avoid PC relative load. | |
| 3353 __ mov(r1, Operand(0x41000000)); | |
| 3354 __ orr(r1, r1, Operand(0x300000)); | |
| 3355 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. | |
| 3356 __ vmov(d7, r0, r1); | |
| 3357 // Move 0x4130000000000000 to VFP. | |
| 3358 __ mov(r0, Operand::Zero()); | |
| 3359 __ vmov(d8, r0, r1); | |
| 3360 // Subtract and store the result in the heap number. | |
| 3361 __ vsub(d7, d7, d8); | |
| 3362 __ sub(r0, r4, Operand(kHeapObjectTag)); | |
| 3363 __ vstr(d7, r0, HeapNumber::kValueOffset); | |
| 3364 __ mov(r0, r4); | |
| 3365 | |
| 3366 context()->Plug(r0); | |
| 3367 } | |
| 3368 | |
| 3369 | |
| 3370 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { | 3326 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { |
| 3371 // Load the arguments on the stack and call the stub. | 3327 // Load the arguments on the stack and call the stub. |
| 3372 SubStringStub stub; | 3328 SubStringStub stub; |
| 3373 ZoneList<Expression*>* args = expr->arguments(); | 3329 ZoneList<Expression*>* args = expr->arguments(); |
| 3374 ASSERT(args->length() == 3); | 3330 ASSERT(args->length() == 3); |
| 3375 VisitForStackValue(args->at(0)); | 3331 VisitForStackValue(args->at(0)); |
| 3376 VisitForStackValue(args->at(1)); | 3332 VisitForStackValue(args->at(1)); |
| 3377 VisitForStackValue(args->at(2)); | 3333 VisitForStackValue(args->at(2)); |
| 3378 __ CallStub(&stub); | 3334 __ CallStub(&stub); |
| 3379 context()->Plug(r0); | 3335 context()->Plug(r0); |
| (...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4978 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4934 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
| 4979 reinterpret_cast<uint32_t>( | 4935 reinterpret_cast<uint32_t>( |
| 4980 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4936 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4981 return OSR_AFTER_STACK_CHECK; | 4937 return OSR_AFTER_STACK_CHECK; |
| 4982 } | 4938 } |
| 4983 | 4939 |
| 4984 | 4940 |
| 4985 } } // namespace v8::internal | 4941 } } // namespace v8::internal |
| 4986 | 4942 |
| 4987 #endif // V8_TARGET_ARCH_ARM | 4943 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |