Commit 26c902ec authored by franzih's avatar franzih Committed by Commit bot

[turbofan] Minor refactoring.

Use CodeStubAssembler functions instead of LoadObjectField with
the offset.

BUG=

Review-Url: https://codereview.chromium.org/2198133002
Cr-Commit-Position: refs/heads/master@{#38229}
parent 4c482bc5
...@@ -522,10 +522,8 @@ SIMD128_TYPES(SIMD128_GEN_ASM) ...@@ -522,10 +522,8 @@ SIMD128_TYPES(SIMD128_GEN_ASM)
void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const { void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const {
compiler::Node* value = assembler->Parameter(0); compiler::Node* value = assembler->Parameter(0);
compiler::Node* string = compiler::Node* string = assembler->LoadJSValueValue(value);
assembler->LoadObjectField(value, JSValue::kValueOffset); compiler::Node* result = assembler->LoadStringLength(string);
compiler::Node* result =
assembler->LoadObjectField(string, String::kLengthOffset);
assembler->Return(result); assembler->Return(result);
} }
...@@ -3397,8 +3395,8 @@ void GenerateStringRelationalComparison(CodeStubAssembler* assembler, ...@@ -3397,8 +3395,8 @@ void GenerateStringRelationalComparison(CodeStubAssembler* assembler,
assembler->Bind(&if_bothonebyteseqstrings); assembler->Bind(&if_bothonebyteseqstrings);
{ {
// Load the length of {lhs} and {rhs}. // Load the length of {lhs} and {rhs}.
Node* lhs_length = assembler->LoadObjectField(lhs, String::kLengthOffset); Node* lhs_length = assembler->LoadStringLength(lhs);
Node* rhs_length = assembler->LoadObjectField(rhs, String::kLengthOffset); Node* rhs_length = assembler->LoadStringLength(rhs);
// Determine the minimum length. // Determine the minimum length.
Node* length = assembler->SmiMin(lhs_length, rhs_length); Node* length = assembler->SmiMin(lhs_length, rhs_length);
...@@ -3569,8 +3567,8 @@ void GenerateStringEqual(CodeStubAssembler* assembler, ResultMode mode) { ...@@ -3569,8 +3567,8 @@ void GenerateStringEqual(CodeStubAssembler* assembler, ResultMode mode) {
// The {lhs} and {rhs} don't refer to the exact same String object. // The {lhs} and {rhs} don't refer to the exact same String object.
// Load the length of {lhs} and {rhs}. // Load the length of {lhs} and {rhs}.
Node* lhs_length = assembler->LoadObjectField(lhs, String::kLengthOffset); Node* lhs_length = assembler->LoadStringLength(lhs);
Node* rhs_length = assembler->LoadObjectField(rhs, String::kLengthOffset); Node* rhs_length = assembler->LoadStringLength(rhs);
// Check if the lengths of {lhs} and {rhs} are equal. // Check if the lengths of {lhs} and {rhs} are equal.
Label if_lengthisequal(assembler), if_lengthisnotequal(assembler); Label if_lengthisequal(assembler), if_lengthisnotequal(assembler);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment