| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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.h" | 5 #include "src/builtins/builtins-utils.h" |
| 6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
| 7 | 7 |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/regexp/jsregexp.h" | 9 #include "src/regexp/jsregexp.h" |
| 10 #include "src/string-builder.h" | 10 #include "src/string-builder.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 { | 372 { |
| 373 Node* const regexp_lastindex = | 373 Node* const regexp_lastindex = |
| 374 LoadLastIndex(a, context, has_initialmap, regexp); | 374 LoadLastIndex(a, context, has_initialmap, regexp); |
| 375 | 375 |
| 376 Callable tolength_callable = CodeFactory::ToLength(isolate); | 376 Callable tolength_callable = CodeFactory::ToLength(isolate); |
| 377 Node* const lastindex = | 377 Node* const lastindex = |
| 378 a->CallStub(tolength_callable, context, regexp_lastindex); | 378 a->CallStub(tolength_callable, context, regexp_lastindex); |
| 379 var_lastindex.Bind(lastindex); | 379 var_lastindex.Bind(lastindex); |
| 380 | 380 |
| 381 Label if_isoob(a, Label::kDeferred); | 381 Label if_isoob(a, Label::kDeferred); |
| 382 a->GotoUnless(a->WordIsSmi(lastindex), &if_isoob); | 382 a->GotoUnless(a->TaggedIsSmi(lastindex), &if_isoob); |
| 383 a->GotoUnless(a->SmiLessThanOrEqual(lastindex, string_length), &if_isoob); | 383 a->GotoUnless(a->SmiLessThanOrEqual(lastindex, string_length), &if_isoob); |
| 384 a->Goto(&run_exec); | 384 a->Goto(&run_exec); |
| 385 | 385 |
| 386 a->Bind(&if_isoob); | 386 a->Bind(&if_isoob); |
| 387 { | 387 { |
| 388 StoreLastIndex(a, context, has_initialmap, regexp, smi_zero); | 388 StoreLastIndex(a, context, has_initialmap, regexp, smi_zero); |
| 389 a->Return(null); | 389 a->Return(null); |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 compiler::Node* context, | 453 compiler::Node* context, |
| 454 compiler::Node* value, | 454 compiler::Node* value, |
| 455 char const* method_name) { | 455 char const* method_name) { |
| 456 typedef compiler::Node Node; | 456 typedef compiler::Node Node; |
| 457 typedef CodeStubAssembler::Label Label; | 457 typedef CodeStubAssembler::Label Label; |
| 458 typedef CodeStubAssembler::Variable Variable; | 458 typedef CodeStubAssembler::Variable Variable; |
| 459 | 459 |
| 460 Label out(a), throw_exception(a, Label::kDeferred); | 460 Label out(a), throw_exception(a, Label::kDeferred); |
| 461 Variable var_value_map(a, MachineRepresentation::kTagged); | 461 Variable var_value_map(a, MachineRepresentation::kTagged); |
| 462 | 462 |
| 463 a->GotoIf(a->WordIsSmi(value), &throw_exception); | 463 a->GotoIf(a->TaggedIsSmi(value), &throw_exception); |
| 464 | 464 |
| 465 // Load the instance type of the {value}. | 465 // Load the instance type of the {value}. |
| 466 var_value_map.Bind(a->LoadMap(value)); | 466 var_value_map.Bind(a->LoadMap(value)); |
| 467 Node* const value_instance_type = | 467 Node* const value_instance_type = |
| 468 a->LoadMapInstanceType(var_value_map.value()); | 468 a->LoadMapInstanceType(var_value_map.value()); |
| 469 | 469 |
| 470 a->Branch(a->IsJSReceiverInstanceType(value_instance_type), &out, | 470 a->Branch(a->IsJSReceiverInstanceType(value_instance_type), &out, |
| 471 &throw_exception); | 471 &throw_exception); |
| 472 | 472 |
| 473 // The {value} is not a compatible receiver for this method. | 473 // The {value} is not a compatible receiver for this method. |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 Node* const receiver = a->Parameter(0); | 720 Node* const receiver = a->Parameter(0); |
| 721 Node* const context = a->Parameter(3); | 721 Node* const context = a->Parameter(3); |
| 722 | 722 |
| 723 Isolate* isolate = a->isolate(); | 723 Isolate* isolate = a->isolate(); |
| 724 Node* const int_zero = a->IntPtrConstant(0); | 724 Node* const int_zero = a->IntPtrConstant(0); |
| 725 | 725 |
| 726 // Check whether we have an unmodified regexp instance. | 726 // Check whether we have an unmodified regexp instance. |
| 727 Label if_isunmodifiedjsregexp(a), | 727 Label if_isunmodifiedjsregexp(a), |
| 728 if_isnotunmodifiedjsregexp(a, Label::kDeferred); | 728 if_isnotunmodifiedjsregexp(a, Label::kDeferred); |
| 729 | 729 |
| 730 a->GotoIf(a->WordIsSmi(receiver), &if_isnotunmodifiedjsregexp); | 730 a->GotoIf(a->TaggedIsSmi(receiver), &if_isnotunmodifiedjsregexp); |
| 731 | 731 |
| 732 Node* const receiver_map = a->LoadMap(receiver); | 732 Node* const receiver_map = a->LoadMap(receiver); |
| 733 Node* const instance_type = a->LoadMapInstanceType(receiver_map); | 733 Node* const instance_type = a->LoadMapInstanceType(receiver_map); |
| 734 | 734 |
| 735 a->Branch(a->Word32Equal(instance_type, a->Int32Constant(JS_REGEXP_TYPE)), | 735 a->Branch(a->Word32Equal(instance_type, a->Int32Constant(JS_REGEXP_TYPE)), |
| 736 &if_isunmodifiedjsregexp, &if_isnotunmodifiedjsregexp); | 736 &if_isunmodifiedjsregexp, &if_isnotunmodifiedjsregexp); |
| 737 | 737 |
| 738 a->Bind(&if_isunmodifiedjsregexp); | 738 a->Bind(&if_isunmodifiedjsregexp); |
| 739 { | 739 { |
| 740 // Refer to JSRegExp's flag property on the fast-path. | 740 // Refer to JSRegExp's flag property on the fast-path. |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 Handle<String> substr = | 1589 Handle<String> substr = |
| 1590 factory->NewSubString(string, prev_string_index, length); | 1590 factory->NewSubString(string, prev_string_index, length); |
| 1591 elems = FixedArray::SetAndGrow(elems, num_elems++, substr); | 1591 elems = FixedArray::SetAndGrow(elems, num_elems++, substr); |
| 1592 } | 1592 } |
| 1593 | 1593 |
| 1594 return *NewJSArrayWithElements(isolate, elems, num_elems); | 1594 return *NewJSArrayWithElements(isolate, elems, num_elems); |
| 1595 } | 1595 } |
| 1596 | 1596 |
| 1597 } // namespace internal | 1597 } // namespace internal |
| 1598 } // namespace v8 | 1598 } // namespace v8 |
| OLD | NEW |