OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/elements.h" | 8 #include "src/elements.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 RUNTIME_FUNCTION(Runtime_ForInFilter) { | 154 RUNTIME_FUNCTION(Runtime_ForInFilter) { |
155 HandleScope scope(isolate); | 155 HandleScope scope(isolate); |
156 DCHECK_EQ(2, args.length()); | 156 DCHECK_EQ(2, args.length()); |
157 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); | 157 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); |
158 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 158 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
159 RETURN_RESULT_OR_FAILURE(isolate, | 159 RETURN_RESULT_OR_FAILURE(isolate, |
160 HasEnumerableProperty(isolate, receiver, key)); | 160 HasEnumerableProperty(isolate, receiver, key)); |
161 } | 161 } |
162 | 162 |
163 | |
164 RUNTIME_FUNCTION(Runtime_ForInNext) { | |
165 HandleScope scope(isolate); | |
166 DCHECK_EQ(4, args.length()); | |
167 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); | |
168 CONVERT_ARG_HANDLE_CHECKED(FixedArray, cache_array, 1); | |
169 CONVERT_ARG_HANDLE_CHECKED(Object, cache_type, 2); | |
170 CONVERT_SMI_ARG_CHECKED(index, 3); | |
171 Handle<Object> key = handle(cache_array->get(index), isolate); | |
172 // Don't need filtering if expected map still matches that of the receiver. | |
173 if (receiver->map() == *cache_type) { | |
174 return *key; | |
175 } | |
176 RETURN_RESULT_OR_FAILURE(isolate, | |
177 HasEnumerableProperty(isolate, receiver, key)); | |
178 } | |
179 | |
180 } // namespace internal | 163 } // namespace internal |
181 } // namespace v8 | 164 } // namespace v8 |
OLD | NEW |