| 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) { |
| 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 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5809 ASSERT(args->length() == 1); | 5815 ASSERT(args->length() == 1); |
| 5810 Load(args->at(0)); | 5816 Load(args->at(0)); |
| 5811 Register value = frame_->PopToRegister(); | 5817 Register value = frame_->PopToRegister(); |
| 5812 | 5818 |
| 5813 __ ldr(value, FieldMemOperand(value, String::kHashFieldOffset)); | 5819 __ ldr(value, FieldMemOperand(value, String::kHashFieldOffset)); |
| 5814 __ IndexFromHash(value, value); | 5820 __ IndexFromHash(value, value); |
| 5815 frame_->EmitPush(value); | 5821 frame_->EmitPush(value); |
| 5816 } | 5822 } |
| 5817 | 5823 |
| 5818 | 5824 |
| 5825 void CodeGenerator::GenerateFastAsciiArrayJoin(ZoneList<Expression*>* args) { |
| 5826 ASSERT(args->length() == 2); |
| 5827 Load(args->at(0)); |
| 5828 Register value = frame_->PopToRegister(); |
| 5829 __ LoadRoot(value, Heap::kUndefinedValueRootIndex); |
| 5830 frame_->EmitPush(value); |
| 5831 } |
| 5832 |
| 5833 |
| 5819 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { | 5834 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { |
| 5820 #ifdef DEBUG | 5835 #ifdef DEBUG |
| 5821 int original_height = frame_->height(); | 5836 int original_height = frame_->height(); |
| 5822 #endif | 5837 #endif |
| 5823 if (CheckForInlineRuntimeCall(node)) { | 5838 if (CheckForInlineRuntimeCall(node)) { |
| 5824 ASSERT((has_cc() && frame_->height() == original_height) || | 5839 ASSERT((has_cc() && frame_->height() == original_height) || |
| 5825 (!has_cc() && frame_->height() == original_height + 1)); | 5840 (!has_cc() && frame_->height() == original_height + 1)); |
| 5826 return; | 5841 return; |
| 5827 } | 5842 } |
| 5828 | 5843 |
| (...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7265 BinaryOpIC::GetName(runtime_operands_type_)); | 7280 BinaryOpIC::GetName(runtime_operands_type_)); |
| 7266 return name_; | 7281 return name_; |
| 7267 } | 7282 } |
| 7268 | 7283 |
| 7269 | 7284 |
| 7270 #undef __ | 7285 #undef __ |
| 7271 | 7286 |
| 7272 } } // namespace v8::internal | 7287 } } // namespace v8::internal |
| 7273 | 7288 |
| 7274 #endif // V8_TARGET_ARCH_ARM | 7289 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |