| OLD | NEW |
| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 in_spilled_code_(false) { | 119 in_spilled_code_(false) { |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 // Calling conventions: | 123 // Calling conventions: |
| 124 // ebp: caller's frame pointer | 124 // ebp: caller's frame pointer |
| 125 // esp: stack pointer | 125 // esp: stack pointer |
| 126 // edi: called JS function | 126 // edi: called JS function |
| 127 // esi: callee's context | 127 // esi: callee's context |
| 128 | 128 |
| 129 void CodeGenerator::GenCode(FunctionLiteral* fun) { | 129 void CodeGenerator::GenCode(FunctionLiteral* fun, CompilationInfo* info) { |
| 130 // Record the position for debugging purposes. | 130 // Record the position for debugging purposes. |
| 131 CodeForFunctionPosition(fun); | 131 CodeForFunctionPosition(fun); |
| 132 | 132 |
| 133 ZoneList<Statement*>* body = fun->body(); | 133 ZoneList<Statement*>* body = fun->body(); |
| 134 | 134 |
| 135 // Initialize state. | 135 // Initialize state. |
| 136 ASSERT(scope_ == NULL); | 136 ASSERT(scope_ == NULL); |
| 137 scope_ = fun->scope(); | 137 scope_ = fun->scope(); |
| 138 ASSERT(allocator_ == NULL); | 138 ASSERT(allocator_ == NULL); |
| 139 RegisterAllocator register_allocator(this); | 139 RegisterAllocator register_allocator(this); |
| 140 allocator_ = ®ister_allocator; | 140 allocator_ = ®ister_allocator; |
| 141 ASSERT(frame_ == NULL); | 141 ASSERT(frame_ == NULL); |
| 142 frame_ = new VirtualFrame(); | 142 frame_ = new VirtualFrame(); |
| 143 set_in_spilled_code(false); | 143 set_in_spilled_code(false); |
| 144 | 144 |
| 145 // Adjust for function-level loop nesting. | 145 // Adjust for function-level loop nesting. |
| 146 loop_nesting_ += fun->loop_nesting(); | 146 loop_nesting_ += info->loop_nesting(); |
| 147 | 147 |
| 148 JumpTarget::set_compiling_deferred_code(false); | 148 JumpTarget::set_compiling_deferred_code(false); |
| 149 | 149 |
| 150 #ifdef DEBUG | 150 #ifdef DEBUG |
| 151 if (strlen(FLAG_stop_at) > 0 && | 151 if (strlen(FLAG_stop_at) > 0 && |
| 152 fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 152 fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
| 153 frame_->SpillAll(); | 153 frame_->SpillAll(); |
| 154 __ int3(); | 154 __ int3(); |
| 155 } | 155 } |
| 156 #endif | 156 #endif |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // compile an artificial return statement just above, and (b) there | 314 // compile an artificial return statement just above, and (b) there |
| 315 // are return statements in the body but (c) they are all shadowed. | 315 // are return statements in the body but (c) they are all shadowed. |
| 316 Result return_value; | 316 Result return_value; |
| 317 function_return_.Bind(&return_value); | 317 function_return_.Bind(&return_value); |
| 318 GenerateReturnSequence(&return_value); | 318 GenerateReturnSequence(&return_value); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 // Adjust for function-level loop nesting. | 323 // Adjust for function-level loop nesting. |
| 324 loop_nesting_ -= fun->loop_nesting(); | 324 loop_nesting_ -= info->loop_nesting(); |
| 325 | 325 |
| 326 // Code generation state must be reset. | 326 // Code generation state must be reset. |
| 327 ASSERT(state_ == NULL); | 327 ASSERT(state_ == NULL); |
| 328 ASSERT(loop_nesting() == 0); | 328 ASSERT(loop_nesting() == 0); |
| 329 ASSERT(!function_return_is_shadowed_); | 329 ASSERT(!function_return_is_shadowed_); |
| 330 function_return_.Unuse(); | 330 function_return_.Unuse(); |
| 331 DeleteFrame(); | 331 DeleteFrame(); |
| 332 | 332 |
| 333 // Process any deferred code using the register allocator. | 333 // Process any deferred code using the register allocator. |
| 334 if (!HasStackOverflow()) { | 334 if (!HasStackOverflow()) { |
| (...skipping 9758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10093 | 10093 |
| 10094 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 10094 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
| 10095 // tagged as a small integer. | 10095 // tagged as a small integer. |
| 10096 __ bind(&runtime); | 10096 __ bind(&runtime); |
| 10097 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); | 10097 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); |
| 10098 } | 10098 } |
| 10099 | 10099 |
| 10100 #undef __ | 10100 #undef __ |
| 10101 | 10101 |
| 10102 } } // namespace v8::internal | 10102 } } // namespace v8::internal |
| OLD | NEW |