OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4938 __ cmp(r0, Operand(0)); | 4938 __ cmp(r0, Operand(0)); |
4939 __ pop(pc); | 4939 __ pop(pc); |
4940 } | 4940 } |
4941 | 4941 |
4942 | 4942 |
4943 // Allocates a heap number or jumps to the label if the young space is full and | 4943 // Allocates a heap number or jumps to the label if the young space is full and |
4944 // a scavenge is needed. | 4944 // a scavenge is needed. |
4945 static void AllocateHeapNumber( | 4945 static void AllocateHeapNumber( |
4946 MacroAssembler* masm, | 4946 MacroAssembler* masm, |
4947 Label* need_gc, // Jump here if young space is full. | 4947 Label* need_gc, // Jump here if young space is full. |
4948 Register result_reg, // The tagged address of the new heap number. | 4948 Register result, // The tagged address of the new heap number. |
4949 Register allocation_top_addr_reg, // A scratch register. | 4949 Register scratch1, // A scratch register. |
4950 Register scratch2) { // Another scratch register. | 4950 Register scratch2) { // Another scratch register. |
4951 ExternalReference allocation_top = | 4951 // Allocate an object in the heap for the heap number and tag it as a heap |
4952 ExternalReference::new_space_allocation_top_address(); | 4952 // object. |
4953 ExternalReference allocation_limit = | 4953 __ AllocateObjectInNewSpace(HeapNumber::kSize, |
4954 ExternalReference::new_space_allocation_limit_address(); | 4954 result, |
| 4955 scratch1, |
| 4956 scratch2, |
| 4957 need_gc, |
| 4958 true); |
4955 | 4959 |
4956 // allocat := the address of the allocation top variable. | 4960 // Get heap number map and store it in the allocated object. |
4957 __ mov(allocation_top_addr_reg, Operand(allocation_top)); | 4961 __ LoadRoot(scratch1, Heap::kHeapNumberMapRootIndex); |
4958 // result_reg := the old allocation top. | 4962 __ str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); |
4959 __ ldr(result_reg, MemOperand(allocation_top_addr_reg)); | |
4960 // scratch2 := the address of the allocation limit. | |
4961 __ mov(scratch2, Operand(allocation_limit)); | |
4962 // scratch2 := the allocation limit. | |
4963 __ ldr(scratch2, MemOperand(scratch2)); | |
4964 // result_reg := the new allocation top. | |
4965 __ add(result_reg, result_reg, Operand(HeapNumber::kSize)); | |
4966 // Compare new new allocation top and limit. | |
4967 __ cmp(result_reg, Operand(scratch2)); | |
4968 // Branch if out of space in young generation. | |
4969 __ b(hi, need_gc); | |
4970 // Store new allocation top. | |
4971 __ str(result_reg, MemOperand(allocation_top_addr_reg)); // store new top | |
4972 // Tag and adjust back to start of new object. | |
4973 __ sub(result_reg, result_reg, Operand(HeapNumber::kSize - kHeapObjectTag)); | |
4974 // Get heap number map into scratch2. | |
4975 __ LoadRoot(scratch2, Heap::kHeapNumberMapRootIndex); | |
4976 // Store heap number map in new object. | |
4977 __ str(scratch2, FieldMemOperand(result_reg, HeapObject::kMapOffset)); | |
4978 } | 4963 } |
4979 | 4964 |
4980 | 4965 |
4981 // We fall into this code if the operands were Smis, but the result was | 4966 // We fall into this code if the operands were Smis, but the result was |
4982 // not (eg. overflow). We branch into this code (to the not_smi label) if | 4967 // not (eg. overflow). We branch into this code (to the not_smi label) if |
4983 // the operands were not both Smi. The operands are in r0 and r1. In order | 4968 // the operands were not both Smi. The operands are in r0 and r1. In order |
4984 // to call the C-implemented binary fp operation routines we need to end up | 4969 // to call the C-implemented binary fp operation routines we need to end up |
4985 // with the double precision floating point operands in r0 and r1 (for the | 4970 // with the double precision floating point operands in r0 and r1 (for the |
4986 // value in r1) and r2 and r3 (for the value in r0). | 4971 // value in r1) and r2 and r3 (for the value in r0). |
4987 static void HandleBinaryOpSlowCases(MacroAssembler* masm, | 4972 static void HandleBinaryOpSlowCases(MacroAssembler* masm, |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6266 int CompareStub::MinorKey() { | 6251 int CompareStub::MinorKey() { |
6267 // Encode the two parameters in a unique 16 bit value. | 6252 // Encode the two parameters in a unique 16 bit value. |
6268 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); | 6253 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); |
6269 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); | 6254 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); |
6270 } | 6255 } |
6271 | 6256 |
6272 | 6257 |
6273 #undef __ | 6258 #undef __ |
6274 | 6259 |
6275 } } // namespace v8::internal | 6260 } } // namespace v8::internal |
OLD | NEW |