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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 a->Bind(&done); | 134 a->Bind(&done); |
135 return var_result.value(); | 135 return var_result.value(); |
136 } | 136 } |
137 | 137 |
138 void ValidateAtomicIndex(CodeStubAssembler* a, compiler::Node* index_word, | 138 void ValidateAtomicIndex(CodeStubAssembler* a, compiler::Node* index_word, |
139 compiler::Node* array_length_word, | 139 compiler::Node* array_length_word, |
140 compiler::Node* context) { | 140 compiler::Node* context) { |
141 using namespace compiler; | 141 using namespace compiler; |
142 // Check if the index is in bounds. If not, throw RangeError. | 142 // Check if the index is in bounds. If not, throw RangeError. |
143 CodeStubAssembler::Label if_inbounds(a), if_notinbounds(a); | 143 CodeStubAssembler::Label if_inbounds(a), if_notinbounds(a); |
144 // TODO(jkummerow): Use unsigned comparison instead of "i<0 || i>length". | |
145 a->Branch( | 144 a->Branch( |
146 a->WordOr(a->Int32LessThan(index_word, a->Int32Constant(0)), | 145 a->WordOr(a->Int32LessThan(index_word, a->Int32Constant(0)), |
147 a->Int32GreaterThanOrEqual(index_word, array_length_word)), | 146 a->Int32GreaterThanOrEqual(index_word, array_length_word)), |
148 &if_notinbounds, &if_inbounds); | 147 &if_notinbounds, &if_inbounds); |
149 a->Bind(&if_notinbounds); | 148 a->Bind(&if_notinbounds); |
150 a->Return( | 149 a->Return( |
151 a->CallRuntime(Runtime::kThrowInvalidAtomicAccessIndexError, context)); | 150 a->CallRuntime(Runtime::kThrowInvalidAtomicAccessIndexError, context)); |
152 a->Bind(&if_inbounds); | 151 a->Bind(&if_inbounds); |
153 } | 152 } |
154 | 153 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 a->WordShl(index_word, 2), value_word32); | 257 a->WordShl(index_word, 2), value_word32); |
259 a->Return(value_integer); | 258 a->Return(value_integer); |
260 | 259 |
261 // This shouldn't happen, we've already validated the type. | 260 // This shouldn't happen, we've already validated the type. |
262 a->Bind(&other); | 261 a->Bind(&other); |
263 a->Return(a->Int32Constant(0)); | 262 a->Return(a->Int32Constant(0)); |
264 } | 263 } |
265 | 264 |
266 } // namespace internal | 265 } // namespace internal |
267 } // namespace v8 | 266 } // namespace v8 |
OLD | NEW |