Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Unified Diff: src/code-stubs.cc

Issue 1827523005: [turbofan] Reduce boilerplate around HeapNumber allocation in stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins.cc ('k') | src/compiler/code-stub-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index fb5f8881dd979776cd1c60cce06c5582663fe860..5a7a2fdb7071a15414ec1d1ad48af4d42f5726d3 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -465,26 +465,19 @@ Handle<Code> TurboFanCodeStub::GenerateCode() {
void AllocateHeapNumberStub::GenerateAssembly(
compiler::CodeStubAssembler* assembler) const {
- compiler::Node* result = assembler->Allocate(
- HeapNumber::kSize, compiler::CodeStubAssembler::kNone);
- compiler::Node* map_offset =
- assembler->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag);
- compiler::Node* map = assembler->IntPtrAdd(result, map_offset);
- assembler->StoreNoWriteBarrier(
- MachineRepresentation::kTagged, map,
- assembler->HeapConstant(isolate()->factory()->heap_number_map()));
+ typedef compiler::Node Node;
+
+ Node* result = assembler->AllocateHeapNumber();
assembler->Return(result);
}
void AllocateMutableHeapNumberStub::GenerateAssembly(
compiler::CodeStubAssembler* assembler) const {
- compiler::Node* result = assembler->Allocate(
- HeapNumber::kSize, compiler::CodeStubAssembler::kNone);
- compiler::Node* map_offset =
- assembler->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag);
- compiler::Node* map = assembler->IntPtrAdd(result, map_offset);
- assembler->StoreNoWriteBarrier(
- MachineRepresentation::kTagged, map,
+ typedef compiler::Node Node;
+
+ Node* result = assembler->Allocate(HeapNumber::kSize);
+ assembler->StoreMapNoWriteBarrier(
+ result,
assembler->HeapConstant(isolate()->factory()->mutable_heap_number_map()));
assembler->Return(result);
}
@@ -867,11 +860,7 @@ void AddStub::GenerateAssembly(compiler::CodeStubAssembler* assembler) const {
Node* rhs_value = var_fadd_rhs.value();
Node* value = assembler->Float64Add(lhs_value, rhs_value);
// TODO(bmeurer): Introduce a ChangeFloat64ToTagged.
- Node* result = assembler->Allocate(HeapNumber::kSize,
- compiler::CodeStubAssembler::kNone);
- assembler->StoreMapNoWriteBarrier(result,
- assembler->HeapNumberMapConstant());
- assembler->StoreHeapNumberValue(result, value);
+ Node* result = assembler->AllocateHeapNumberWithValue(value);
assembler->Return(result);
}
}
@@ -1040,11 +1029,7 @@ void SubtractStub::GenerateAssembly(
Node* rhs_value = var_fsub_rhs.value();
Node* value = assembler->Float64Sub(lhs_value, rhs_value);
// TODO(bmeurer): Introduce a ChangeFloat64ToTagged.
- Node* result = assembler->Allocate(HeapNumber::kSize,
- compiler::CodeStubAssembler::kNone);
- assembler->StoreMapNoWriteBarrier(result,
- assembler->HeapNumberMapConstant());
- assembler->StoreHeapNumberValue(result, value);
+ Node* result = assembler->AllocateHeapNumberWithValue(value);
assembler->Return(result);
}
}
« no previous file with comments | « src/builtins.cc ('k') | src/compiler/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698