| 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.h" | 5 #include "src/builtins/builtins.h" |
| 6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
| 7 | 7 |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 void ValidateSharedTypedArray(CodeStubAssembler* a, compiler::Node* tagged, | 30 void ValidateSharedTypedArray(CodeStubAssembler* a, compiler::Node* tagged, |
| 31 compiler::Node* context, | 31 compiler::Node* context, |
| 32 compiler::Node** out_instance_type, | 32 compiler::Node** out_instance_type, |
| 33 compiler::Node** out_backing_store) { | 33 compiler::Node** out_backing_store) { |
| 34 using namespace compiler; | 34 using namespace compiler; |
| 35 CodeStubAssembler::Label is_smi(a), not_smi(a), is_typed_array(a), | 35 CodeStubAssembler::Label is_smi(a), not_smi(a), is_typed_array(a), |
| 36 not_typed_array(a), is_shared(a), not_shared(a), is_float_or_clamped(a), | 36 not_typed_array(a), is_shared(a), not_shared(a), is_float_or_clamped(a), |
| 37 not_float_or_clamped(a), invalid(a); | 37 not_float_or_clamped(a), invalid(a); |
| 38 | 38 |
| 39 // Fail if it is not a heap object. | 39 // Fail if it is not a heap object. |
| 40 a->Branch(a->WordIsSmi(tagged), &is_smi, ¬_smi); | 40 a->Branch(a->TaggedIsSmi(tagged), &is_smi, ¬_smi); |
| 41 a->Bind(&is_smi); | 41 a->Bind(&is_smi); |
| 42 a->Goto(&invalid); | 42 a->Goto(&invalid); |
| 43 | 43 |
| 44 // Fail if the array's instance type is not JSTypedArray. | 44 // Fail if the array's instance type is not JSTypedArray. |
| 45 a->Bind(¬_smi); | 45 a->Bind(¬_smi); |
| 46 a->Branch(a->WordEqual(a->LoadInstanceType(tagged), | 46 a->Branch(a->WordEqual(a->LoadInstanceType(tagged), |
| 47 a->Int32Constant(JS_TYPED_ARRAY_TYPE)), | 47 a->Int32Constant(JS_TYPED_ARRAY_TYPE)), |
| 48 &is_typed_array, ¬_typed_array); | 48 &is_typed_array, ¬_typed_array); |
| 49 a->Bind(¬_typed_array); | 49 a->Bind(¬_typed_array); |
| 50 a->Goto(&invalid); | 50 a->Goto(&invalid); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 compiler::Node* tagged, | 95 compiler::Node* tagged, |
| 96 compiler::Node* context) { | 96 compiler::Node* context) { |
| 97 using namespace compiler; | 97 using namespace compiler; |
| 98 CodeStubAssembler::Variable var_result(a, MachineRepresentation::kWord32); | 98 CodeStubAssembler::Variable var_result(a, MachineRepresentation::kWord32); |
| 99 | 99 |
| 100 Callable to_number = CodeFactory::ToNumber(a->isolate()); | 100 Callable to_number = CodeFactory::ToNumber(a->isolate()); |
| 101 Node* number_index = a->CallStub(to_number, context, tagged); | 101 Node* number_index = a->CallStub(to_number, context, tagged); |
| 102 CodeStubAssembler::Label done(a, &var_result); | 102 CodeStubAssembler::Label done(a, &var_result); |
| 103 | 103 |
| 104 CodeStubAssembler::Label if_numberissmi(a), if_numberisnotsmi(a); | 104 CodeStubAssembler::Label if_numberissmi(a), if_numberisnotsmi(a); |
| 105 a->Branch(a->WordIsSmi(number_index), &if_numberissmi, &if_numberisnotsmi); | 105 a->Branch(a->TaggedIsSmi(number_index), &if_numberissmi, &if_numberisnotsmi); |
| 106 | 106 |
| 107 a->Bind(&if_numberissmi); | 107 a->Bind(&if_numberissmi); |
| 108 { | 108 { |
| 109 var_result.Bind(a->SmiToWord32(number_index)); | 109 var_result.Bind(a->SmiToWord32(number_index)); |
| 110 a->Goto(&done); | 110 a->Goto(&done); |
| 111 } | 111 } |
| 112 | 112 |
| 113 a->Bind(&if_numberisnotsmi); | 113 a->Bind(&if_numberisnotsmi); |
| 114 { | 114 { |
| 115 Node* number_index_value = a->LoadHeapNumberValue(number_index); | 115 Node* number_index_value = a->LoadHeapNumberValue(number_index); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 a->WordShl(index_word, 2), value_word32); | 257 a->WordShl(index_word, 2), value_word32); |
| 258 a->Return(value_integer); | 258 a->Return(value_integer); |
| 259 | 259 |
| 260 // This shouldn't happen, we've already validated the type. | 260 // This shouldn't happen, we've already validated the type. |
| 261 a->Bind(&other); | 261 a->Bind(&other); |
| 262 a->Return(a->Int32Constant(0)); | 262 a->Return(a->Int32Constant(0)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace internal | 265 } // namespace internal |
| 266 } // namespace v8 | 266 } // namespace v8 |
| OLD | NEW |