Chromium Code Reviews| 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 3085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3096 CodeForStatementPosition(node); | 3096 CodeForStatementPosition(node); |
| 3097 #ifdef ENABLE_DEBUGGER_SUPPORT | 3097 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 3098 frame_->DebugBreak(); | 3098 frame_->DebugBreak(); |
| 3099 #endif | 3099 #endif |
| 3100 // Ignore the return value. | 3100 // Ignore the return value. |
| 3101 ASSERT(frame_->height() == original_height); | 3101 ASSERT(frame_->height() == original_height); |
| 3102 } | 3102 } |
| 3103 | 3103 |
| 3104 | 3104 |
| 3105 void CodeGenerator::InstantiateFunction( | 3105 void CodeGenerator::InstantiateFunction( |
| 3106 Handle<SharedFunctionInfo> function_info) { | 3106 Handle<SharedFunctionInfo> function_info, |
| 3107 bool pretenure) { | |
|
Søren Thygesen Gjesse
2010/11/19 13:31:04
bool -> PretenureFlag?
Mads Ager (chromium)
2010/11/22 09:56:24
Right. I didn't find a better way of doing this. I
| |
| 3107 // Use the fast case closure allocation code that allocates in new | 3108 // Use the fast case closure allocation code that allocates in new |
| 3108 // space for nested functions that don't need literals cloning. | 3109 // space for nested functions that don't need literals cloning. |
| 3109 if (scope()->is_function_scope() && function_info->num_literals() == 0) { | 3110 if (scope()->is_function_scope() && |
| 3111 function_info->num_literals() == 0 && | |
| 3112 !pretenure) { | |
| 3110 FastNewClosureStub stub; | 3113 FastNewClosureStub stub; |
| 3111 frame_->EmitPush(Operand(function_info)); | 3114 frame_->EmitPush(Operand(function_info)); |
| 3112 frame_->SpillAll(); | 3115 frame_->SpillAll(); |
| 3113 frame_->CallStub(&stub, 1); | 3116 frame_->CallStub(&stub, 1); |
| 3114 frame_->EmitPush(r0); | 3117 frame_->EmitPush(r0); |
| 3115 } else { | 3118 } else { |
| 3116 // Create a new closure. | 3119 // Create a new closure. |
| 3117 frame_->EmitPush(cp); | 3120 frame_->EmitPush(cp); |
| 3118 frame_->EmitPush(Operand(function_info)); | 3121 frame_->EmitPush(Operand(function_info)); |
| 3119 frame_->CallRuntime(Runtime::kNewClosure, 2); | 3122 frame_->EmitPush(Operand(pretenure |
| 3123 ? Factory::true_value() | |
| 3124 : Factory::false_value())); | |
| 3125 frame_->CallRuntime(Runtime::kNewClosure, 3); | |
| 3120 frame_->EmitPush(r0); | 3126 frame_->EmitPush(r0); |
| 3121 } | 3127 } |
| 3122 } | 3128 } |
| 3123 | 3129 |
| 3124 | 3130 |
| 3125 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { | 3131 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { |
| 3126 #ifdef DEBUG | 3132 #ifdef DEBUG |
| 3127 int original_height = frame_->height(); | 3133 int original_height = frame_->height(); |
| 3128 #endif | 3134 #endif |
| 3129 Comment cmnt(masm_, "[ FunctionLiteral"); | 3135 Comment cmnt(masm_, "[ FunctionLiteral"); |
| 3130 | 3136 |
| 3131 // Build the function info and instantiate it. | 3137 // Build the function info and instantiate it. |
| 3132 Handle<SharedFunctionInfo> function_info = | 3138 Handle<SharedFunctionInfo> function_info = |
| 3133 Compiler::BuildFunctionInfo(node, script()); | 3139 Compiler::BuildFunctionInfo(node, script()); |
| 3134 if (function_info.is_null()) { | 3140 if (function_info.is_null()) { |
| 3135 SetStackOverflow(); | 3141 SetStackOverflow(); |
| 3136 ASSERT(frame_->height() == original_height); | 3142 ASSERT(frame_->height() == original_height); |
| 3137 return; | 3143 return; |
| 3138 } | 3144 } |
| 3139 InstantiateFunction(function_info); | 3145 InstantiateFunction(function_info, node->pretenure()); |
| 3140 ASSERT_EQ(original_height + 1, frame_->height()); | 3146 ASSERT_EQ(original_height + 1, frame_->height()); |
| 3141 } | 3147 } |
| 3142 | 3148 |
| 3143 | 3149 |
| 3144 void CodeGenerator::VisitSharedFunctionInfoLiteral( | 3150 void CodeGenerator::VisitSharedFunctionInfoLiteral( |
| 3145 SharedFunctionInfoLiteral* node) { | 3151 SharedFunctionInfoLiteral* node) { |
| 3146 #ifdef DEBUG | 3152 #ifdef DEBUG |
| 3147 int original_height = frame_->height(); | 3153 int original_height = frame_->height(); |
| 3148 #endif | 3154 #endif |
| 3149 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); | 3155 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); |
| 3150 InstantiateFunction(node->shared_function_info()); | 3156 InstantiateFunction(node->shared_function_info(), false); |
| 3151 ASSERT_EQ(original_height + 1, frame_->height()); | 3157 ASSERT_EQ(original_height + 1, frame_->height()); |
| 3152 } | 3158 } |
| 3153 | 3159 |
| 3154 | 3160 |
| 3155 void CodeGenerator::VisitConditional(Conditional* node) { | 3161 void CodeGenerator::VisitConditional(Conditional* node) { |
| 3156 #ifdef DEBUG | 3162 #ifdef DEBUG |
| 3157 int original_height = frame_->height(); | 3163 int original_height = frame_->height(); |
| 3158 #endif | 3164 #endif |
| 3159 Comment cmnt(masm_, "[ Conditional"); | 3165 Comment cmnt(masm_, "[ Conditional"); |
| 3160 JumpTarget then; | 3166 JumpTarget then; |
| (...skipping 4113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7274 BinaryOpIC::GetName(runtime_operands_type_)); | 7280 BinaryOpIC::GetName(runtime_operands_type_)); |
| 7275 return name_; | 7281 return name_; |
| 7276 } | 7282 } |
| 7277 | 7283 |
| 7278 | 7284 |
| 7279 #undef __ | 7285 #undef __ |
| 7280 | 7286 |
| 7281 } } // namespace v8::internal | 7287 } } // namespace v8::internal |
| 7282 | 7288 |
| 7283 #endif // V8_TARGET_ARCH_ARM | 7289 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |