| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 JumpTarget::set_compiling_deferred_code(false); | 184 JumpTarget::set_compiling_deferred_code(false); |
| 185 | 185 |
| 186 #ifdef DEBUG | 186 #ifdef DEBUG |
| 187 if (strlen(FLAG_stop_at) > 0 && | 187 if (strlen(FLAG_stop_at) > 0 && |
| 188 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 188 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
| 189 frame_->SpillAll(); | 189 frame_->SpillAll(); |
| 190 __ int3(); | 190 __ int3(); |
| 191 } | 191 } |
| 192 #endif | 192 #endif |
| 193 | 193 |
| 194 // New scope to get automatic timing calculation. | 194 { |
| 195 { HistogramTimerScope codegen_timer(&Counters::code_generation); | |
| 196 CodeGenState state(this); | 195 CodeGenState state(this); |
| 197 | |
| 198 // Entry: | 196 // Entry: |
| 199 // Stack: receiver, arguments, return address. | 197 // Stack: receiver, arguments, return address. |
| 200 // ebp: caller's frame pointer | 198 // ebp: caller's frame pointer |
| 201 // esp: stack pointer | 199 // esp: stack pointer |
| 202 // edi: called JS function | 200 // edi: called JS function |
| 203 // esi: callee's context | 201 // esi: callee's context |
| 204 allocator_->Initialize(); | 202 allocator_->Initialize(); |
| 205 | 203 |
| 206 frame_->Enter(); | 204 frame_->Enter(); |
| 207 | 205 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 loop_nesting_ = 0; | 360 loop_nesting_ = 0; |
| 363 | 361 |
| 364 // Code generation state must be reset. | 362 // Code generation state must be reset. |
| 365 ASSERT(state_ == NULL); | 363 ASSERT(state_ == NULL); |
| 366 ASSERT(!function_return_is_shadowed_); | 364 ASSERT(!function_return_is_shadowed_); |
| 367 function_return_.Unuse(); | 365 function_return_.Unuse(); |
| 368 DeleteFrame(); | 366 DeleteFrame(); |
| 369 | 367 |
| 370 // Process any deferred code using the register allocator. | 368 // Process any deferred code using the register allocator. |
| 371 if (!HasStackOverflow()) { | 369 if (!HasStackOverflow()) { |
| 372 HistogramTimerScope deferred_timer(&Counters::deferred_code_generation); | |
| 373 JumpTarget::set_compiling_deferred_code(true); | 370 JumpTarget::set_compiling_deferred_code(true); |
| 374 ProcessDeferred(); | 371 ProcessDeferred(); |
| 375 JumpTarget::set_compiling_deferred_code(false); | 372 JumpTarget::set_compiling_deferred_code(false); |
| 376 } | 373 } |
| 377 | 374 |
| 378 // There is no need to delete the register allocator, it is a | 375 // There is no need to delete the register allocator, it is a |
| 379 // stack-allocated local. | 376 // stack-allocated local. |
| 380 allocator_ = NULL; | 377 allocator_ = NULL; |
| 381 } | 378 } |
| 382 | 379 |
| (...skipping 4535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4918 return frame()->CallRuntime(Runtime::kNewClosure, 2); | 4915 return frame()->CallRuntime(Runtime::kNewClosure, 2); |
| 4919 } | 4916 } |
| 4920 } | 4917 } |
| 4921 | 4918 |
| 4922 | 4919 |
| 4923 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { | 4920 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { |
| 4924 Comment cmnt(masm_, "[ FunctionLiteral"); | 4921 Comment cmnt(masm_, "[ FunctionLiteral"); |
| 4925 ASSERT(!in_safe_int32_mode()); | 4922 ASSERT(!in_safe_int32_mode()); |
| 4926 // Build the function info and instantiate it. | 4923 // Build the function info and instantiate it. |
| 4927 Handle<SharedFunctionInfo> function_info = | 4924 Handle<SharedFunctionInfo> function_info = |
| 4928 Compiler::BuildFunctionInfo(node, script(), this); | 4925 Compiler::BuildFunctionInfo(node, script()); |
| 4929 // Check for stack-overflow exception. | 4926 // Check for stack-overflow exception. |
| 4930 if (HasStackOverflow()) return; | 4927 if (function_info.is_null()) { |
| 4928 SetStackOverflow(); |
| 4929 return; |
| 4930 } |
| 4931 Result result = InstantiateFunction(function_info); | 4931 Result result = InstantiateFunction(function_info); |
| 4932 frame()->Push(&result); | 4932 frame()->Push(&result); |
| 4933 } | 4933 } |
| 4934 | 4934 |
| 4935 | 4935 |
| 4936 void CodeGenerator::VisitSharedFunctionInfoLiteral( | 4936 void CodeGenerator::VisitSharedFunctionInfoLiteral( |
| 4937 SharedFunctionInfoLiteral* node) { | 4937 SharedFunctionInfoLiteral* node) { |
| 4938 ASSERT(!in_safe_int32_mode()); | 4938 ASSERT(!in_safe_int32_mode()); |
| 4939 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); | 4939 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); |
| 4940 Result result = InstantiateFunction(node->shared_function_info()); | 4940 Result result = InstantiateFunction(node->shared_function_info()); |
| (...skipping 5195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10136 masm.GetCode(&desc); | 10136 masm.GetCode(&desc); |
| 10137 // Call the function from C++. | 10137 // Call the function from C++. |
| 10138 return FUNCTION_CAST<MemCopyFunction>(buffer); | 10138 return FUNCTION_CAST<MemCopyFunction>(buffer); |
| 10139 } | 10139 } |
| 10140 | 10140 |
| 10141 #undef __ | 10141 #undef __ |
| 10142 | 10142 |
| 10143 } } // namespace v8::internal | 10143 } } // namespace v8::internal |
| 10144 | 10144 |
| 10145 #endif // V8_TARGET_ARCH_IA32 | 10145 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |