| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2306 } | 2306 } |
| 2307 | 2307 |
| 2308 assembler->Bind(&if_valueissmi); | 2308 assembler->Bind(&if_valueissmi); |
| 2309 assembler->Goto(if_equal); | 2309 assembler->Goto(if_equal); |
| 2310 } | 2310 } |
| 2311 | 2311 |
| 2312 void GenerateEqual_Simd128Value_HeapObject( | 2312 void GenerateEqual_Simd128Value_HeapObject( |
| 2313 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* lhs_map, | 2313 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* lhs_map, |
| 2314 compiler::Node* rhs, compiler::Node* rhs_map, | 2314 compiler::Node* rhs, compiler::Node* rhs_map, |
| 2315 CodeStubAssembler::Label* if_equal, CodeStubAssembler::Label* if_notequal) { | 2315 CodeStubAssembler::Label* if_equal, CodeStubAssembler::Label* if_notequal) { |
| 2316 typedef CodeStubAssembler::Label Label; | 2316 assembler->BranchIfSimd128Equal(lhs, lhs_map, rhs, rhs_map, if_equal, |
| 2317 typedef compiler::Node Node; | 2317 if_notequal); |
| 2318 | |
| 2319 // Check if {lhs} and {rhs} have the same map. | |
| 2320 Label if_mapsame(assembler), if_mapnotsame(assembler); | |
| 2321 assembler->Branch(assembler->WordEqual(lhs_map, rhs_map), &if_mapsame, | |
| 2322 &if_mapnotsame); | |
| 2323 | |
| 2324 assembler->Bind(&if_mapsame); | |
| 2325 { | |
| 2326 // Both {lhs} and {rhs} are Simd128Values with the same map, need special | |
| 2327 // handling for Float32x4 because of NaN comparisons. | |
| 2328 Label if_float32x4(assembler), if_notfloat32x4(assembler); | |
| 2329 Node* float32x4_map = | |
| 2330 assembler->HeapConstant(assembler->factory()->float32x4_map()); | |
| 2331 assembler->Branch(assembler->WordEqual(lhs_map, float32x4_map), | |
| 2332 &if_float32x4, &if_notfloat32x4); | |
| 2333 | |
| 2334 assembler->Bind(&if_float32x4); | |
| 2335 { | |
| 2336 // Both {lhs} and {rhs} are Float32x4, compare the lanes individually | |
| 2337 // using a floating point comparison. | |
| 2338 for (int offset = Float32x4::kValueOffset - kHeapObjectTag; | |
| 2339 offset < Float32x4::kSize - kHeapObjectTag; | |
| 2340 offset += sizeof(float)) { | |
| 2341 // Load the floating point values for {lhs} and {rhs}. | |
| 2342 Node* lhs_value = assembler->Load(MachineType::Float32(), lhs, | |
| 2343 assembler->IntPtrConstant(offset)); | |
| 2344 Node* rhs_value = assembler->Load(MachineType::Float32(), rhs, | |
| 2345 assembler->IntPtrConstant(offset)); | |
| 2346 | |
| 2347 // Perform a floating point comparison. | |
| 2348 Label if_valueequal(assembler), if_valuenotequal(assembler); | |
| 2349 assembler->Branch(assembler->Float32Equal(lhs_value, rhs_value), | |
| 2350 &if_valueequal, &if_valuenotequal); | |
| 2351 assembler->Bind(&if_valuenotequal); | |
| 2352 assembler->Goto(if_notequal); | |
| 2353 assembler->Bind(&if_valueequal); | |
| 2354 } | |
| 2355 | |
| 2356 // All 4 lanes match, {lhs} and {rhs} considered equal. | |
| 2357 assembler->Goto(if_equal); | |
| 2358 } | |
| 2359 | |
| 2360 assembler->Bind(&if_notfloat32x4); | |
| 2361 { | |
| 2362 // For other Simd128Values we just perform a bitwise comparison. | |
| 2363 for (int offset = Simd128Value::kValueOffset - kHeapObjectTag; | |
| 2364 offset < Simd128Value::kSize - kHeapObjectTag; | |
| 2365 offset += kPointerSize) { | |
| 2366 // Load the word values for {lhs} and {rhs}. | |
| 2367 Node* lhs_value = assembler->Load(MachineType::Pointer(), lhs, | |
| 2368 assembler->IntPtrConstant(offset)); | |
| 2369 Node* rhs_value = assembler->Load(MachineType::Pointer(), rhs, | |
| 2370 assembler->IntPtrConstant(offset)); | |
| 2371 | |
| 2372 // Perform a bitwise word-comparison. | |
| 2373 Label if_valueequal(assembler), if_valuenotequal(assembler); | |
| 2374 assembler->Branch(assembler->WordEqual(lhs_value, rhs_value), | |
| 2375 &if_valueequal, &if_valuenotequal); | |
| 2376 assembler->Bind(&if_valuenotequal); | |
| 2377 assembler->Goto(if_notequal); | |
| 2378 assembler->Bind(&if_valueequal); | |
| 2379 } | |
| 2380 | |
| 2381 // Bitwise comparison succeeded, {lhs} and {rhs} considered equal. | |
| 2382 assembler->Goto(if_equal); | |
| 2383 } | |
| 2384 } | |
| 2385 | |
| 2386 assembler->Bind(&if_mapnotsame); | |
| 2387 assembler->Goto(if_notequal); | |
| 2388 } | 2318 } |
| 2389 | 2319 |
| 2390 // ES6 section 7.2.12 Abstract Equality Comparison | 2320 // ES6 section 7.2.12 Abstract Equality Comparison |
| 2391 compiler::Node* GenerateEqual(CodeStubAssembler* assembler, ResultMode mode, | 2321 compiler::Node* GenerateEqual(CodeStubAssembler* assembler, ResultMode mode, |
| 2392 compiler::Node* lhs, compiler::Node* rhs, | 2322 compiler::Node* lhs, compiler::Node* rhs, |
| 2393 compiler::Node* context) { | 2323 compiler::Node* context) { |
| 2394 // This is a slightly optimized version of Object::Equals represented as | 2324 // This is a slightly optimized version of Object::Equals represented as |
| 2395 // scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you | 2325 // scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you |
| 2396 // change something functionality wise in here, remember to update the | 2326 // change something functionality wise in here, remember to update the |
| 2397 // Object::Equals method as well. | 2327 // Object::Equals method as well. |
| (...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4936 if (type->Is(Type::UntaggedPointer())) { | 4866 if (type->Is(Type::UntaggedPointer())) { |
| 4937 return Representation::External(); | 4867 return Representation::External(); |
| 4938 } | 4868 } |
| 4939 | 4869 |
| 4940 DCHECK(!type->Is(Type::Untagged())); | 4870 DCHECK(!type->Is(Type::Untagged())); |
| 4941 return Representation::Tagged(); | 4871 return Representation::Tagged(); |
| 4942 } | 4872 } |
| 4943 | 4873 |
| 4944 } // namespace internal | 4874 } // namespace internal |
| 4945 } // namespace v8 | 4875 } // namespace v8 |
| OLD | NEW |