| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 #endif | 108 #endif |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 | 111 |
| 112 // Generate code for a JS function. On entry to the function the receiver | 112 // Generate code for a JS function. On entry to the function the receiver |
| 113 // and arguments have been pushed on the stack left to right. The actual | 113 // and arguments have been pushed on the stack left to right. The actual |
| 114 // argument count matches the formal parameter count expected by the | 114 // argument count matches the formal parameter count expected by the |
| 115 // function. | 115 // function. |
| 116 // | 116 // |
| 117 // The live registers are: | 117 // The live registers are: |
| 118 // o r1: the JS function object being called (ie, ourselves) | 118 // o r1: the JS function object being called (i.e., ourselves) |
| 119 // o cp: our context | 119 // o cp: our context |
| 120 // o fp: our caller's frame pointer | 120 // o fp: our caller's frame pointer |
| 121 // o sp: stack pointer | 121 // o sp: stack pointer |
| 122 // o lr: return address | 122 // o lr: return address |
| 123 // | 123 // |
| 124 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 124 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 125 // frames-arm.h for its layout. | 125 // frames-arm.h for its layout. |
| 126 void FullCodeGenerator::Generate(CompilationInfo* info) { | 126 void FullCodeGenerator::Generate(CompilationInfo* info) { |
| 127 ASSERT(info_ == NULL); | 127 ASSERT(info_ == NULL); |
| 128 info_ = info; | 128 info_ = info; |
| (...skipping 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3611 __ SmiUntag(string_length); | 3611 __ SmiUntag(string_length); |
| 3612 __ add(string, string, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); | 3612 __ add(string, string, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); |
| 3613 __ CopyBytes(string, result_pos, string_length, scratch1); | 3613 __ CopyBytes(string, result_pos, string_length, scratch1); |
| 3614 __ cmp(element, elements_end); | 3614 __ cmp(element, elements_end); |
| 3615 __ b(lt, &empty_separator_loop); // End while (element < elements_end). | 3615 __ b(lt, &empty_separator_loop); // End while (element < elements_end). |
| 3616 ASSERT(result.is(r0)); | 3616 ASSERT(result.is(r0)); |
| 3617 __ b(&done); | 3617 __ b(&done); |
| 3618 | 3618 |
| 3619 // One-character separator case | 3619 // One-character separator case |
| 3620 __ bind(&one_char_separator); | 3620 __ bind(&one_char_separator); |
| 3621 // Replace separator with its ascii character value. | 3621 // Replace separator with its ASCII character value. |
| 3622 __ ldrb(separator, FieldMemOperand(separator, SeqAsciiString::kHeaderSize)); | 3622 __ ldrb(separator, FieldMemOperand(separator, SeqAsciiString::kHeaderSize)); |
| 3623 // Jump into the loop after the code that copies the separator, so the first | 3623 // Jump into the loop after the code that copies the separator, so the first |
| 3624 // element is not preceded by a separator | 3624 // element is not preceded by a separator |
| 3625 __ jmp(&one_char_separator_loop_entry); | 3625 __ jmp(&one_char_separator_loop_entry); |
| 3626 | 3626 |
| 3627 __ bind(&one_char_separator_loop); | 3627 __ bind(&one_char_separator_loop); |
| 3628 // Live values in registers: | 3628 // Live values in registers: |
| 3629 // result_pos: the position to which we are currently copying characters. | 3629 // result_pos: the position to which we are currently copying characters. |
| 3630 // element: Current array element. | 3630 // element: Current array element. |
| 3631 // elements_end: Array end. | 3631 // elements_end: Array end. |
| 3632 // separator: Single separator ascii char (in lower byte). | 3632 // separator: Single separator ASCII char (in lower byte). |
| 3633 | 3633 |
| 3634 // Copy the separator character to the result. | 3634 // Copy the separator character to the result. |
| 3635 __ strb(separator, MemOperand(result_pos, 1, PostIndex)); | 3635 __ strb(separator, MemOperand(result_pos, 1, PostIndex)); |
| 3636 | 3636 |
| 3637 // Copy next array element to the result. | 3637 // Copy next array element to the result. |
| 3638 __ bind(&one_char_separator_loop_entry); | 3638 __ bind(&one_char_separator_loop_entry); |
| 3639 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); | 3639 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); |
| 3640 __ ldr(string_length, FieldMemOperand(string, String::kLengthOffset)); | 3640 __ ldr(string_length, FieldMemOperand(string, String::kLengthOffset)); |
| 3641 __ SmiUntag(string_length); | 3641 __ SmiUntag(string_length); |
| 3642 __ add(string, string, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); | 3642 __ add(string, string, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4390 *context_length = 0; | 4390 *context_length = 0; |
| 4391 return previous_; | 4391 return previous_; |
| 4392 } | 4392 } |
| 4393 | 4393 |
| 4394 | 4394 |
| 4395 #undef __ | 4395 #undef __ |
| 4396 | 4396 |
| 4397 } } // namespace v8::internal | 4397 } } // namespace v8::internal |
| 4398 | 4398 |
| 4399 #endif // V8_TARGET_ARCH_ARM | 4399 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |