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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 #endif | 118 #endif |
119 }; | 119 }; |
120 | 120 |
121 | 121 |
122 // Generate code for a JS function. On entry to the function the receiver | 122 // Generate code for a JS function. On entry to the function the receiver |
123 // and arguments have been pushed on the stack left to right. The actual | 123 // and arguments have been pushed on the stack left to right. The actual |
124 // argument count matches the formal parameter count expected by the | 124 // argument count matches the formal parameter count expected by the |
125 // function. | 125 // function. |
126 // | 126 // |
127 // The live registers are: | 127 // The live registers are: |
128 // o a1: the JS function object being called (ie, ourselves) | 128 // o a1: the JS function object being called (i.e. ourselves) |
129 // o cp: our context | 129 // o cp: our context |
130 // o fp: our caller's frame pointer | 130 // o fp: our caller's frame pointer |
131 // o sp: stack pointer | 131 // o sp: stack pointer |
132 // o ra: return address | 132 // o ra: return address |
133 // | 133 // |
134 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 134 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
135 // frames-mips.h for its layout. | 135 // frames-mips.h for its layout. |
136 void FullCodeGenerator::Generate(CompilationInfo* info) { | 136 void FullCodeGenerator::Generate(CompilationInfo* info) { |
137 ASSERT(info_ == NULL); | 137 ASSERT(info_ == NULL); |
138 info_ = info; | 138 info_ = info; |
(...skipping 3509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3648 __ SmiUntag(string_length); | 3648 __ SmiUntag(string_length); |
3649 __ Addu(string, string, SeqAsciiString::kHeaderSize - kHeapObjectTag); | 3649 __ Addu(string, string, SeqAsciiString::kHeaderSize - kHeapObjectTag); |
3650 __ CopyBytes(string, result_pos, string_length, scratch1); | 3650 __ CopyBytes(string, result_pos, string_length, scratch1); |
3651 // End while (element < elements_end). | 3651 // End while (element < elements_end). |
3652 __ Branch(&empty_separator_loop, lt, element, Operand(elements_end)); | 3652 __ Branch(&empty_separator_loop, lt, element, Operand(elements_end)); |
3653 ASSERT(result.is(v0)); | 3653 ASSERT(result.is(v0)); |
3654 __ Branch(&done); | 3654 __ Branch(&done); |
3655 | 3655 |
3656 // One-character separator case. | 3656 // One-character separator case. |
3657 __ bind(&one_char_separator); | 3657 __ bind(&one_char_separator); |
3658 // Replace separator with its ascii character value. | 3658 // Replace separator with its ASCII character value. |
3659 __ lbu(separator, FieldMemOperand(separator, SeqAsciiString::kHeaderSize)); | 3659 __ lbu(separator, FieldMemOperand(separator, SeqAsciiString::kHeaderSize)); |
3660 // Jump into the loop after the code that copies the separator, so the first | 3660 // Jump into the loop after the code that copies the separator, so the first |
3661 // element is not preceded by a separator. | 3661 // element is not preceded by a separator. |
3662 __ jmp(&one_char_separator_loop_entry); | 3662 __ jmp(&one_char_separator_loop_entry); |
3663 | 3663 |
3664 __ bind(&one_char_separator_loop); | 3664 __ bind(&one_char_separator_loop); |
3665 // Live values in registers: | 3665 // Live values in registers: |
3666 // result_pos: the position to which we are currently copying characters. | 3666 // result_pos: the position to which we are currently copying characters. |
3667 // element: Current array element. | 3667 // element: Current array element. |
3668 // elements_end: Array end. | 3668 // elements_end: Array end. |
3669 // separator: Single separator ascii char (in lower byte). | 3669 // separator: Single separator ASCII char (in lower byte). |
3670 | 3670 |
3671 // Copy the separator character to the result. | 3671 // Copy the separator character to the result. |
3672 __ sb(separator, MemOperand(result_pos)); | 3672 __ sb(separator, MemOperand(result_pos)); |
3673 __ Addu(result_pos, result_pos, 1); | 3673 __ Addu(result_pos, result_pos, 1); |
3674 | 3674 |
3675 // Copy next array element to the result. | 3675 // Copy next array element to the result. |
3676 __ bind(&one_char_separator_loop_entry); | 3676 __ bind(&one_char_separator_loop_entry); |
3677 __ lw(string, MemOperand(element)); | 3677 __ lw(string, MemOperand(element)); |
3678 __ Addu(element, element, kPointerSize); | 3678 __ Addu(element, element, kPointerSize); |
3679 __ lw(string_length, FieldMemOperand(string, String::kLengthOffset)); | 3679 __ lw(string_length, FieldMemOperand(string, String::kLengthOffset)); |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4426 *context_length = 0; | 4426 *context_length = 0; |
4427 return previous_; | 4427 return previous_; |
4428 } | 4428 } |
4429 | 4429 |
4430 | 4430 |
4431 #undef __ | 4431 #undef __ |
4432 | 4432 |
4433 } } // namespace v8::internal | 4433 } } // namespace v8::internal |
4434 | 4434 |
4435 #endif // V8_TARGET_ARCH_MIPS | 4435 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |