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-string-gen.h" | 5 #include "src/builtins/builtins-string-gen.h" |
6 #include "src/builtins/builtins-utils-gen.h" | 6 #include "src/builtins/builtins-utils-gen.h" |
7 #include "src/builtins/builtins.h" | 7 #include "src/builtins/builtins.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 Label throw_null_undefined_exception(this, Label::kDeferred); | 341 Label throw_null_undefined_exception(this, Label::kDeferred); |
342 GotoIf(WordEqual(receiver(), NullConstant()), | 342 GotoIf(WordEqual(receiver(), NullConstant()), |
343 &throw_null_undefined_exception); | 343 &throw_null_undefined_exception); |
344 GotoIf(WordEqual(receiver(), UndefinedConstant()), | 344 GotoIf(WordEqual(receiver(), UndefinedConstant()), |
345 &throw_null_undefined_exception); | 345 &throw_null_undefined_exception); |
346 | 346 |
347 // By the book: taken directly from the ECMAScript 2015 specification | 347 // By the book: taken directly from the ECMAScript 2015 specification |
348 | 348 |
349 // 1. Let O be ToObject(this value). | 349 // 1. Let O be ToObject(this value). |
350 // 2. ReturnIfAbrupt(O) | 350 // 2. ReturnIfAbrupt(O) |
351 o_ = CallStub(CodeFactory::ToObject(isolate()), context(), receiver()); | 351 o_ = CallBuiltin(Builtins::kToObject, context(), receiver()); |
352 | 352 |
353 // 3. Let len be ToLength(Get(O, "length")). | 353 // 3. Let len be ToLength(Get(O, "length")). |
354 // 4. ReturnIfAbrupt(len). | 354 // 4. ReturnIfAbrupt(len). |
355 VARIABLE(merged_length, MachineRepresentation::kTagged); | 355 VARIABLE(merged_length, MachineRepresentation::kTagged); |
356 Label has_length(this, &merged_length), not_js_array(this); | 356 Label has_length(this, &merged_length), not_js_array(this); |
357 GotoIf(DoesntHaveInstanceType(o(), JS_ARRAY_TYPE), ¬_js_array); | 357 GotoIf(DoesntHaveInstanceType(o(), JS_ARRAY_TYPE), ¬_js_array); |
358 merged_length.Bind(LoadJSArrayLength(o())); | 358 merged_length.Bind(LoadJSArrayLength(o())); |
359 Goto(&has_length); | 359 Goto(&has_length); |
360 BIND(¬_js_array); | 360 BIND(¬_js_array); |
361 Node* len_property = | 361 Node* len_property = |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 | 2008 |
2009 GotoIf(TaggedIsSmi(receiver), &if_isnotobject); | 2009 GotoIf(TaggedIsSmi(receiver), &if_isnotobject); |
2010 var_array.Bind(receiver); | 2010 var_array.Bind(receiver); |
2011 var_map.Bind(LoadMap(receiver)); | 2011 var_map.Bind(LoadMap(receiver)); |
2012 var_type.Bind(LoadMapInstanceType(var_map.value())); | 2012 var_type.Bind(LoadMapInstanceType(var_map.value())); |
2013 Branch(IsJSReceiverInstanceType(var_type.value()), &create_array_iterator, | 2013 Branch(IsJSReceiverInstanceType(var_type.value()), &create_array_iterator, |
2014 &if_isnotobject); | 2014 &if_isnotobject); |
2015 | 2015 |
2016 BIND(&if_isnotobject); | 2016 BIND(&if_isnotobject); |
2017 { | 2017 { |
2018 Callable callable = CodeFactory::ToObject(isolate()); | 2018 Node* result = CallBuiltin(Builtins::kToObject, context, receiver); |
2019 Node* result = CallStub(callable, context, receiver); | |
2020 var_array.Bind(result); | 2019 var_array.Bind(result); |
2021 var_map.Bind(LoadMap(result)); | 2020 var_map.Bind(LoadMap(result)); |
2022 var_type.Bind(LoadMapInstanceType(var_map.value())); | 2021 var_type.Bind(LoadMapInstanceType(var_map.value())); |
2023 Goto(&create_array_iterator); | 2022 Goto(&create_array_iterator); |
2024 } | 2023 } |
2025 | 2024 |
2026 BIND(&create_array_iterator); | 2025 BIND(&create_array_iterator); |
2027 Return(CreateArrayIterator(var_array.value(), var_map.value(), | 2026 Return(CreateArrayIterator(var_array.value(), var_map.value(), |
2028 var_type.value(), context, iteration_kind)); | 2027 var_type.value(), context, iteration_kind)); |
2029 } | 2028 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2464 { | 2463 { |
2465 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); | 2464 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); |
2466 CallRuntime(Runtime::kThrowTypeError, context, message, | 2465 CallRuntime(Runtime::kThrowTypeError, context, message, |
2467 HeapConstant(operation)); | 2466 HeapConstant(operation)); |
2468 Unreachable(); | 2467 Unreachable(); |
2469 } | 2468 } |
2470 } | 2469 } |
2471 | 2470 |
2472 } // namespace internal | 2471 } // namespace internal |
2473 } // namespace v8 | 2472 } // namespace v8 |
OLD | NEW |