| OLD | NEW | 
|---|
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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/builtins/builtins-utils-gen.h" | 5 #include "src/builtins/builtins-utils-gen.h" | 
| 6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" | 
| 7 #include "src/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" | 
| 8 | 8 | 
| 9 namespace v8 { | 9 namespace v8 { | 
| 10 namespace internal { | 10 namespace internal { | 
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 325     // 3. Let len be ToLength(Get(O, "length")). | 325     // 3. Let len be ToLength(Get(O, "length")). | 
| 326     // 4. ReturnIfAbrupt(len). | 326     // 4. ReturnIfAbrupt(len). | 
| 327     VARIABLE(merged_length, MachineRepresentation::kTagged); | 327     VARIABLE(merged_length, MachineRepresentation::kTagged); | 
| 328     Label has_length(this, &merged_length), not_js_array(this); | 328     Label has_length(this, &merged_length), not_js_array(this); | 
| 329     GotoIf(DoesntHaveInstanceType(o(), JS_ARRAY_TYPE), ¬_js_array); | 329     GotoIf(DoesntHaveInstanceType(o(), JS_ARRAY_TYPE), ¬_js_array); | 
| 330     merged_length.Bind(LoadJSArrayLength(o())); | 330     merged_length.Bind(LoadJSArrayLength(o())); | 
| 331     Goto(&has_length); | 331     Goto(&has_length); | 
| 332     BIND(¬_js_array); | 332     BIND(¬_js_array); | 
| 333     Node* len_property = | 333     Node* len_property = | 
| 334         GetProperty(context(), o(), isolate()->factory()->length_string()); | 334         GetProperty(context(), o(), isolate()->factory()->length_string()); | 
| 335     merged_length.Bind( | 335     merged_length.Bind(ToLength_Inline(context(), len_property)); | 
| 336         CallStub(CodeFactory::ToLength(isolate()), context(), len_property)); |  | 
| 337     Goto(&has_length); | 336     Goto(&has_length); | 
| 338     BIND(&has_length); | 337     BIND(&has_length); | 
| 339     len_ = merged_length.value(); | 338     len_ = merged_length.value(); | 
| 340 | 339 | 
| 341     // 5. If IsCallable(callbackfn) is false, throw a TypeError exception. | 340     // 5. If IsCallable(callbackfn) is false, throw a TypeError exception. | 
| 342     Label type_exception(this, Label::kDeferred); | 341     Label type_exception(this, Label::kDeferred); | 
| 343     Label done(this); | 342     Label done(this); | 
| 344     GotoIf(TaggedIsSmi(callbackfn()), &type_exception); | 343     GotoIf(TaggedIsSmi(callbackfn()), &type_exception); | 
| 345     Branch(IsCallableMap(LoadMap(callbackfn())), &done, &type_exception); | 344     Branch(IsCallableMap(LoadMap(callbackfn())), &done, &type_exception); | 
| 346 | 345 | 
| (...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2174             Node* cell = LoadRoot(Heap::kFastArrayIterationProtectorRootIndex); | 2173             Node* cell = LoadRoot(Heap::kFastArrayIterationProtectorRootIndex); | 
| 2175             StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset, invalid); | 2174             StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset, invalid); | 
| 2176             Goto(&done); | 2175             Goto(&done); | 
| 2177           } | 2176           } | 
| 2178         } | 2177         } | 
| 2179 | 2178 | 
| 2180         BIND(&if_isnotarray); | 2179         BIND(&if_isnotarray); | 
| 2181         { | 2180         { | 
| 2182           Node* length = | 2181           Node* length = | 
| 2183               GetProperty(context, array, factory()->length_string()); | 2182               GetProperty(context, array, factory()->length_string()); | 
| 2184           Callable to_length = CodeFactory::ToLength(isolate()); | 2183           var_length.Bind(ToLength_Inline(context, length)); | 
| 2185           var_length.Bind(CallStub(to_length, context, length)); |  | 
| 2186           Goto(&done); | 2184           Goto(&done); | 
| 2187         } | 2185         } | 
| 2188 | 2186 | 
| 2189         BIND(&done); | 2187         BIND(&done); | 
| 2190         length = var_length.value(); | 2188         length = var_length.value(); | 
| 2191       } | 2189       } | 
| 2192 | 2190 | 
| 2193       GotoUnlessNumberLessThan(index, length, &set_done); | 2191       GotoUnlessNumberLessThan(index, length, &set_done); | 
| 2194 | 2192 | 
| 2195       StoreObjectField(iterator, JSArrayIterator::kNextIndexOffset, | 2193       StoreObjectField(iterator, JSArrayIterator::kNextIndexOffset, | 
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2400   { | 2398   { | 
| 2401     Node* message = SmiConstant(MessageTemplate::kDetachedOperation); | 2399     Node* message = SmiConstant(MessageTemplate::kDetachedOperation); | 
| 2402     CallRuntime(Runtime::kThrowTypeError, context, message, | 2400     CallRuntime(Runtime::kThrowTypeError, context, message, | 
| 2403                 HeapConstant(operation)); | 2401                 HeapConstant(operation)); | 
| 2404     Unreachable(); | 2402     Unreachable(); | 
| 2405   } | 2403   } | 
| 2406 } | 2404 } | 
| 2407 | 2405 | 
| 2408 }  // namespace internal | 2406 }  // namespace internal | 
| 2409 }  // namespace v8 | 2407 }  // namespace v8 | 
| OLD | NEW | 
|---|