OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 15125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15136 | 15136 |
15137 // TODO(dcarney): remove this function when TurboFan supports it. | 15137 // TODO(dcarney): remove this function when TurboFan supports it. |
15138 // Takes the object to be iterated over and the result of GetPropertyNamesFast | 15138 // Takes the object to be iterated over and the result of GetPropertyNamesFast |
15139 // Returns pair (cache_array, cache_type). | 15139 // Returns pair (cache_array, cache_type). |
15140 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_ForInInit) { | 15140 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_ForInInit) { |
15141 SealHandleScope scope(isolate); | 15141 SealHandleScope scope(isolate); |
15142 ASSERT(args.length() == 2); | 15142 ASSERT(args.length() == 2); |
15143 // This simulates CONVERT_ARG_HANDLE_CHECKED for calls returning pairs. | 15143 // This simulates CONVERT_ARG_HANDLE_CHECKED for calls returning pairs. |
15144 // Not worth creating a macro atm as this function should be removed. | 15144 // Not worth creating a macro atm as this function should be removed. |
15145 if (!args[0]->IsJSReceiver() || !args[1]->IsObject()) { | 15145 if (!args[0]->IsJSReceiver() || !args[1]->IsObject()) { |
15146 return MakePair(isolate->ThrowIllegalOperation(), | 15146 Object* error = isolate->ThrowIllegalOperation(); |
15147 isolate->heap()->undefined_value()); | 15147 return MakePair(error, isolate->heap()->undefined_value()); |
15148 } | 15148 } |
15149 Handle<JSReceiver> object = args.at<JSReceiver>(0); | 15149 Handle<JSReceiver> object = args.at<JSReceiver>(0); |
15150 Handle<Object> cache_type = args.at<Object>(1); | 15150 Handle<Object> cache_type = args.at<Object>(1); |
15151 if (cache_type->IsMap()) { | 15151 if (cache_type->IsMap()) { |
15152 // Enum cache case. | 15152 // Enum cache case. |
15153 if (Map::EnumLengthBits::decode(Map::cast(*cache_type)->bit_field3()) == | 15153 if (Map::EnumLengthBits::decode(Map::cast(*cache_type)->bit_field3()) == |
15154 0) { | 15154 0) { |
15155 // 0 length enum. | 15155 // 0 length enum. |
15156 // Can't handle this case in the graph builder, | 15156 // Can't handle this case in the graph builder, |
15157 // so transform it into the empty fixed array case. | 15157 // so transform it into the empty fixed array case. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15190 // cache_type from ForInInit, | 15190 // cache_type from ForInInit, |
15191 // the current index) | 15191 // the current index) |
15192 // Returns pair (array[index], needs_filtering). | 15192 // Returns pair (array[index], needs_filtering). |
15193 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_ForInNext) { | 15193 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_ForInNext) { |
15194 SealHandleScope scope(isolate); | 15194 SealHandleScope scope(isolate); |
15195 ASSERT(args.length() == 4); | 15195 ASSERT(args.length() == 4); |
15196 // This simulates CONVERT_ARG_HANDLE_CHECKED for calls returning pairs. | 15196 // This simulates CONVERT_ARG_HANDLE_CHECKED for calls returning pairs. |
15197 // Not worth creating a macro atm as this function should be removed. | 15197 // Not worth creating a macro atm as this function should be removed. |
15198 if (!args[0]->IsJSReceiver() || !args[1]->IsFixedArray() || | 15198 if (!args[0]->IsJSReceiver() || !args[1]->IsFixedArray() || |
15199 !args[2]->IsObject() || !args[3]->IsSmi()) { | 15199 !args[2]->IsObject() || !args[3]->IsSmi()) { |
15200 return MakePair(isolate->ThrowIllegalOperation(), | 15200 Object* error = isolate->ThrowIllegalOperation(); |
15201 isolate->heap()->undefined_value()); | 15201 return MakePair(error, isolate->heap()->undefined_value()); |
15202 } | 15202 } |
15203 Handle<JSReceiver> object = args.at<JSReceiver>(0); | 15203 Handle<JSReceiver> object = args.at<JSReceiver>(0); |
15204 Handle<FixedArray> array = args.at<FixedArray>(1); | 15204 Handle<FixedArray> array = args.at<FixedArray>(1); |
15205 Handle<Object> cache_type = args.at<Object>(2); | 15205 Handle<Object> cache_type = args.at<Object>(2); |
15206 int index = args.smi_at(3); | 15206 int index = args.smi_at(3); |
15207 // Figure out first if a slow check is needed for this object. | 15207 // Figure out first if a slow check is needed for this object. |
15208 bool slow_check_needed = false; | 15208 bool slow_check_needed = false; |
15209 if (cache_type->IsMap()) { | 15209 if (cache_type->IsMap()) { |
15210 if (object->map() != Map::cast(*cache_type)) { | 15210 if (object->map() != Map::cast(*cache_type)) { |
15211 // Object transitioned. Need slow check. | 15211 // Object transitioned. Need slow check. |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15612 } | 15612 } |
15613 return NULL; | 15613 return NULL; |
15614 } | 15614 } |
15615 | 15615 |
15616 | 15616 |
15617 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15617 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15618 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15618 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15619 } | 15619 } |
15620 | 15620 |
15621 } } // namespace v8::internal | 15621 } } // namespace v8::internal |
OLD | NEW |