| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 JumpTarget::set_compiling_deferred_code(false); | 183 JumpTarget::set_compiling_deferred_code(false); |
| 184 | 184 |
| 185 #ifdef DEBUG | 185 #ifdef DEBUG |
| 186 if (strlen(FLAG_stop_at) > 0 && | 186 if (strlen(FLAG_stop_at) > 0 && |
| 187 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 187 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
| 188 frame_->SpillAll(); | 188 frame_->SpillAll(); |
| 189 __ int3(); | 189 __ int3(); |
| 190 } | 190 } |
| 191 #endif | 191 #endif |
| 192 | 192 |
| 193 // New scope to get automatic timing calculation. | 193 { |
| 194 { HistogramTimerScope codegen_timer(&Counters::code_generation); | |
| 195 CodeGenState state(this); | 194 CodeGenState state(this); |
| 196 | |
| 197 // Entry: | 195 // Entry: |
| 198 // Stack: receiver, arguments, return address. | 196 // Stack: receiver, arguments, return address. |
| 199 // rbp: caller's frame pointer | 197 // rbp: caller's frame pointer |
| 200 // rsp: stack pointer | 198 // rsp: stack pointer |
| 201 // rdi: called JS function | 199 // rdi: called JS function |
| 202 // rsi: callee's context | 200 // rsi: callee's context |
| 203 allocator_->Initialize(); | 201 allocator_->Initialize(); |
| 204 | 202 |
| 205 frame_->Enter(); | 203 frame_->Enter(); |
| 206 | 204 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 loop_nesting_ = 0; | 358 loop_nesting_ = 0; |
| 361 | 359 |
| 362 // Code generation state must be reset. | 360 // Code generation state must be reset. |
| 363 ASSERT(state_ == NULL); | 361 ASSERT(state_ == NULL); |
| 364 ASSERT(!function_return_is_shadowed_); | 362 ASSERT(!function_return_is_shadowed_); |
| 365 function_return_.Unuse(); | 363 function_return_.Unuse(); |
| 366 DeleteFrame(); | 364 DeleteFrame(); |
| 367 | 365 |
| 368 // Process any deferred code using the register allocator. | 366 // Process any deferred code using the register allocator. |
| 369 if (!HasStackOverflow()) { | 367 if (!HasStackOverflow()) { |
| 370 HistogramTimerScope deferred_timer(&Counters::deferred_code_generation); | |
| 371 JumpTarget::set_compiling_deferred_code(true); | 368 JumpTarget::set_compiling_deferred_code(true); |
| 372 ProcessDeferred(); | 369 ProcessDeferred(); |
| 373 JumpTarget::set_compiling_deferred_code(false); | 370 JumpTarget::set_compiling_deferred_code(false); |
| 374 } | 371 } |
| 375 | 372 |
| 376 // There is no need to delete the register allocator, it is a | 373 // There is no need to delete the register allocator, it is a |
| 377 // stack-allocated local. | 374 // stack-allocated local. |
| 378 allocator_ = NULL; | 375 allocator_ = NULL; |
| 379 } | 376 } |
| 380 | 377 |
| (...skipping 3888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4269 frame_->Push(&result); | 4266 frame_->Push(&result); |
| 4270 } | 4267 } |
| 4271 } | 4268 } |
| 4272 | 4269 |
| 4273 | 4270 |
| 4274 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { | 4271 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { |
| 4275 Comment cmnt(masm_, "[ FunctionLiteral"); | 4272 Comment cmnt(masm_, "[ FunctionLiteral"); |
| 4276 | 4273 |
| 4277 // Build the function info and instantiate it. | 4274 // Build the function info and instantiate it. |
| 4278 Handle<SharedFunctionInfo> function_info = | 4275 Handle<SharedFunctionInfo> function_info = |
| 4279 Compiler::BuildFunctionInfo(node, script(), this); | 4276 Compiler::BuildFunctionInfo(node, script()); |
| 4280 // Check for stack-overflow exception. | 4277 // Check for stack-overflow exception. |
| 4281 if (HasStackOverflow()) return; | 4278 if (function_info.is_null()) { |
| 4279 SetStackOverflow(); |
| 4280 return; |
| 4281 } |
| 4282 InstantiateFunction(function_info); | 4282 InstantiateFunction(function_info); |
| 4283 } | 4283 } |
| 4284 | 4284 |
| 4285 | 4285 |
| 4286 void CodeGenerator::VisitSharedFunctionInfoLiteral( | 4286 void CodeGenerator::VisitSharedFunctionInfoLiteral( |
| 4287 SharedFunctionInfoLiteral* node) { | 4287 SharedFunctionInfoLiteral* node) { |
| 4288 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); | 4288 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); |
| 4289 InstantiateFunction(node->shared_function_info()); | 4289 InstantiateFunction(node->shared_function_info()); |
| 4290 } | 4290 } |
| 4291 | 4291 |
| (...skipping 4631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8923 #undef __ | 8923 #undef __ |
| 8924 | 8924 |
| 8925 void RecordWriteStub::Generate(MacroAssembler* masm) { | 8925 void RecordWriteStub::Generate(MacroAssembler* masm) { |
| 8926 masm->RecordWriteHelper(object_, addr_, scratch_); | 8926 masm->RecordWriteHelper(object_, addr_, scratch_); |
| 8927 masm->ret(0); | 8927 masm->ret(0); |
| 8928 } | 8928 } |
| 8929 | 8929 |
| 8930 } } // namespace v8::internal | 8930 } } // namespace v8::internal |
| 8931 | 8931 |
| 8932 #endif // V8_TARGET_ARCH_X64 | 8932 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |