Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: src/arm/codegen-arm.cc

Issue 1549031: Call to C function support in macro assembler... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 3938 matching lines...) Expand 10 before | Expand all | Expand 10 after
3949 3949
3950 __ AllocateHeapNumber(r0, r1, r2, &slow_allocate_heapnumber); 3950 __ AllocateHeapNumber(r0, r1, r2, &slow_allocate_heapnumber);
3951 __ jmp(&heapnumber_allocated); 3951 __ jmp(&heapnumber_allocated);
3952 3952
3953 __ bind(&slow_allocate_heapnumber); 3953 __ bind(&slow_allocate_heapnumber);
3954 __ mov(r0, Operand(Smi::FromInt(0))); 3954 __ mov(r0, Operand(Smi::FromInt(0)));
3955 __ push(r0); 3955 __ push(r0);
3956 __ CallRuntime(Runtime::kNumberUnaryMinus, 1); 3956 __ CallRuntime(Runtime::kNumberUnaryMinus, 1);
3957 3957
3958 __ bind(&heapnumber_allocated); 3958 __ bind(&heapnumber_allocated);
3959 __ Call(ExternalReference::fill_heap_number_with_random_function().address(), 3959 __ PrepareCallCFunction(1, r1);
3960 RelocInfo::RUNTIME_ENTRY); 3960 __ CallCFunction(
3961 ExternalReference::fill_heap_number_with_random_function(), 1);
3961 frame_->EmitPush(r0); 3962 frame_->EmitPush(r0);
3962 } 3963 }
3963 3964
3964 3965
3965 void CodeGenerator::GenerateStringAdd(ZoneList<Expression*>* args) { 3966 void CodeGenerator::GenerateStringAdd(ZoneList<Expression*>* args) {
3966 ASSERT_EQ(2, args->length()); 3967 ASSERT_EQ(2, args->length());
3967 3968
3968 Load(args->at(0)); 3969 Load(args->at(0));
3969 Load(args->at(1)); 3970 Load(args->at(1));
3970 3971
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
5951 __ mov(pc, lr); 5952 __ mov(pc, lr);
5952 } else { 5953 } else {
5953 // If we did not inline the operation, then the arguments are in: 5954 // If we did not inline the operation, then the arguments are in:
5954 // r0: Left value (least significant part of mantissa). 5955 // r0: Left value (least significant part of mantissa).
5955 // r1: Left value (sign, exponent, top of mantissa). 5956 // r1: Left value (sign, exponent, top of mantissa).
5956 // r2: Right value (least significant part of mantissa). 5957 // r2: Right value (least significant part of mantissa).
5957 // r3: Right value (sign, exponent, top of mantissa). 5958 // r3: Right value (sign, exponent, top of mantissa).
5958 // r5: Address of heap number for result. 5959 // r5: Address of heap number for result.
5959 5960
5960 __ push(lr); // For later. 5961 __ push(lr); // For later.
5961 __ push(r5); // Address of heap number that is answer. 5962 __ PrepareCallCFunction(4, r4); // Two doubles count as 4 arguments.
5962 __ AlignStack(0); 5963 // Call C routine that may not cause GC or other trouble. r5 is callee
5963 // Call C routine that may not cause GC or other trouble. 5964 // save.
5964 __ mov(r5, Operand(ExternalReference::double_fp_operation(op_))); 5965 __ CallCFunction(ExternalReference::double_fp_operation(op_), 4);
5965 __ Call(r5);
5966 __ pop(r4); // Address of heap number.
5967 __ cmp(r4, Operand(Smi::FromInt(0)));
5968 __ pop(r4, eq); // Conditional pop instruction
5969 // to get rid of alignment push.
5970 // Store answer in the overwritable heap number. 5966 // Store answer in the overwritable heap number.
5971 #if !defined(USE_ARM_EABI) 5967 #if !defined(USE_ARM_EABI)
5972 // Double returned in fp coprocessor register 0 and 1, encoded as register 5968 // Double returned in fp coprocessor register 0 and 1, encoded as register
5973 // cr8. Offsets must be divisible by 4 for coprocessor so we need to 5969 // cr8. Offsets must be divisible by 4 for coprocessor so we need to
5974 // substract the tag from r4. 5970 // substract the tag from r5.
5975 __ sub(r5, r4, Operand(kHeapObjectTag)); 5971 __ sub(r4, r5, Operand(kHeapObjectTag));
5976 __ stc(p1, cr8, MemOperand(r5, HeapNumber::kValueOffset)); 5972 __ stc(p1, cr8, MemOperand(r4, HeapNumber::kValueOffset));
5977 #else 5973 #else
5978 // Double returned in registers 0 and 1. 5974 // Double returned in registers 0 and 1.
5979 __ str(r0, FieldMemOperand(r4, HeapNumber::kValueOffset)); 5975 __ str(r0, FieldMemOperand(r5, HeapNumber::kValueOffset));
5980 __ str(r1, FieldMemOperand(r4, HeapNumber::kValueOffset + 4)); 5976 __ str(r1, FieldMemOperand(r5, HeapNumber::kValueOffset + 4));
5981 #endif 5977 #endif
5982 __ mov(r0, Operand(r4)); 5978 __ mov(r0, Operand(r5));
5983 // And we are done. 5979 // And we are done.
5984 __ pop(pc); 5980 __ pop(pc);
5985 } 5981 }
5986 } 5982 }
5987 // We jump to here if something goes wrong (one param is not a number of any 5983 // We jump to here if something goes wrong (one param is not a number of any
5988 // sort or new-space allocation fails). 5984 // sort or new-space allocation fails).
5989 __ bind(&slow); 5985 __ bind(&slow);
5990 5986
5991 // Push arguments to the stack 5987 // Push arguments to the stack
5992 __ push(r1); 5988 __ push(r1);
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after
8329 8325
8330 // Just jump to runtime to add the two strings. 8326 // Just jump to runtime to add the two strings.
8331 __ bind(&string_add_runtime); 8327 __ bind(&string_add_runtime);
8332 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 8328 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
8333 } 8329 }
8334 8330
8335 8331
8336 #undef __ 8332 #undef __
8337 8333
8338 } } // namespace v8::internal 8334 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698