| 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". |
| 144 a->Branch( | 145 a->Branch( |
| 145 a->WordOr(a->Int32LessThan(index_word, a->Int32Constant(0)), | 146 a->WordOr(a->Int32LessThan(index_word, a->Int32Constant(0)), |
| 146 a->Int32GreaterThanOrEqual(index_word, array_length_word)), | 147 a->Int32GreaterThanOrEqual(index_word, array_length_word)), |
| 147 &if_notinbounds, &if_inbounds); | 148 &if_notinbounds, &if_inbounds); |
| 148 a->Bind(&if_notinbounds); | 149 a->Bind(&if_notinbounds); |
| 149 a->Return( | 150 a->Return( |
| 150 a->CallRuntime(Runtime::kThrowInvalidAtomicAccessIndexError, context)); | 151 a->CallRuntime(Runtime::kThrowInvalidAtomicAccessIndexError, context)); |
| 151 a->Bind(&if_inbounds); | 152 a->Bind(&if_inbounds); |
| 152 } | 153 } |
| 153 | 154 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 a->WordShl(index_word, 2), value_word32); | 258 a->WordShl(index_word, 2), value_word32); |
| 258 a->Return(value_integer); | 259 a->Return(value_integer); |
| 259 | 260 |
| 260 // This shouldn't happen, we've already validated the type. | 261 // This shouldn't happen, we've already validated the type. |
| 261 a->Bind(&other); | 262 a->Bind(&other); |
| 262 a->Return(a->Int32Constant(0)); | 263 a->Return(a->Int32Constant(0)); |
| 263 } | 264 } |
| 264 | 265 |
| 265 } // namespace internal | 266 } // namespace internal |
| 266 } // namespace v8 | 267 } // namespace v8 |
| OLD | NEW |