| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 #endif | 99 #endif |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 | 102 |
| 103 // Generate code for a JS function. On entry to the function the receiver | 103 // Generate code for a JS function. On entry to the function the receiver |
| 104 // and arguments have been pushed on the stack left to right, with the | 104 // and arguments have been pushed on the stack left to right, with the |
| 105 // return address on top of them. The actual argument count matches the | 105 // return address on top of them. The actual argument count matches the |
| 106 // formal parameter count expected by the function. | 106 // formal parameter count expected by the function. |
| 107 // | 107 // |
| 108 // The live registers are: | 108 // The live registers are: |
| 109 // o edi: the JS function object being called (ie, ourselves) | 109 // o edi: the JS function object being called (i.e. ourselves) |
| 110 // o esi: our context | 110 // o esi: our context |
| 111 // o ebp: our caller's frame pointer | 111 // o ebp: our caller's frame pointer |
| 112 // o esp: stack pointer (pointing to return address) | 112 // o esp: stack pointer (pointing to return address) |
| 113 // | 113 // |
| 114 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 114 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 115 // frames-ia32.h for its layout. | 115 // frames-ia32.h for its layout. |
| 116 void FullCodeGenerator::Generate(CompilationInfo* info) { | 116 void FullCodeGenerator::Generate(CompilationInfo* info) { |
| 117 ASSERT(info_ == NULL); | 117 ASSERT(info_ == NULL); |
| 118 info_ = info; | 118 info_ = info; |
| 119 scope_ = info->scope(); | 119 scope_ = info->scope(); |
| (...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3564 __ add(index, Immediate(1)); | 3564 __ add(index, Immediate(1)); |
| 3565 __ bind(&loop_1_condition); | 3565 __ bind(&loop_1_condition); |
| 3566 __ cmp(index, array_length_operand); | 3566 __ cmp(index, array_length_operand); |
| 3567 __ j(less, &loop_1); // End while (index < length). | 3567 __ j(less, &loop_1); // End while (index < length). |
| 3568 __ jmp(&done); | 3568 __ jmp(&done); |
| 3569 | 3569 |
| 3570 | 3570 |
| 3571 | 3571 |
| 3572 // One-character separator case | 3572 // One-character separator case |
| 3573 __ bind(&one_char_separator); | 3573 __ bind(&one_char_separator); |
| 3574 // Replace separator with its ascii character value. | 3574 // Replace separator with its ASCII character value. |
| 3575 __ mov_b(scratch, FieldOperand(string, SeqAsciiString::kHeaderSize)); | 3575 __ mov_b(scratch, FieldOperand(string, SeqAsciiString::kHeaderSize)); |
| 3576 __ mov_b(separator_operand, scratch); | 3576 __ mov_b(separator_operand, scratch); |
| 3577 | 3577 |
| 3578 __ Set(index, Immediate(0)); | 3578 __ Set(index, Immediate(0)); |
| 3579 // Jump into the loop after the code that copies the separator, so the first | 3579 // Jump into the loop after the code that copies the separator, so the first |
| 3580 // element is not preceded by a separator | 3580 // element is not preceded by a separator |
| 3581 __ jmp(&loop_2_entry); | 3581 __ jmp(&loop_2_entry); |
| 3582 // Loop condition: while (index < length). | 3582 // Loop condition: while (index < length). |
| 3583 __ bind(&loop_2); | 3583 __ bind(&loop_2); |
| 3584 // Each iteration of the loop concatenates one string to the result. | 3584 // Each iteration of the loop concatenates one string to the result. |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4380 *context_length = 0; | 4380 *context_length = 0; |
| 4381 return previous_; | 4381 return previous_; |
| 4382 } | 4382 } |
| 4383 | 4383 |
| 4384 | 4384 |
| 4385 #undef __ | 4385 #undef __ |
| 4386 | 4386 |
| 4387 } } // namespace v8::internal | 4387 } } // namespace v8::internal |
| 4388 | 4388 |
| 4389 #endif // V8_TARGET_ARCH_IA32 | 4389 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |