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

Unified Diff: src/assembler.h

Issue 2900683002: [compiler] Delay allocation of code-embedded heap numbers. (Closed)
Patch Set: Fix rebase. Created 3 years, 7 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/arm64/macro-assembler-arm64-inl.h ('k') | src/assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index bfdd659c01b57661e73f9a0d7a4b20face63eaf2..54a967371bf028d54dc59a9a5c38212818432126 100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -35,6 +35,8 @@
#ifndef V8_ASSEMBLER_H_
#define V8_ASSEMBLER_H_
+#include <forward_list>
+
#include "src/allocation.h"
#include "src/builtins/builtins.h"
#include "src/deoptimize-reason.h"
@@ -147,6 +149,17 @@ class AssemblerBase: public Malloced {
// The program counter, which points into the buffer above and moves forward.
byte* pc_;
+ // The following two functions help with avoiding allocations of heap numbers
+ // during the code assembly phase. {RequestHeapNumber} records the need for a
+ // future heap number allocation, together with the current pc offset. After
+ // code assembly, {AllocateRequestedHeapNumbers} will allocate these numbers
+ // and, with the help of {Assembler::set_heap_number}, place them where they
+ // are expected (determined by the recorded pc offset).
+ void RequestHeapNumber(double value) {
+ heap_numbers_.emplace_front(value, pc_offset());
+ }
+ void AllocateRequestedHeapNumbers(Isolate* isolate);
+
private:
IsolateData isolate_data_;
uint64_t enabled_cpu_features_;
@@ -160,6 +173,16 @@ class AssemblerBase: public Malloced {
// Constant pool.
friend class FrameAndConstantPoolScope;
friend class ConstantPoolUnavailableScope;
+
+ // Delayed allocation of heap numbers.
+ struct RequestedHeapNumber {
+ RequestedHeapNumber(double value, int offset);
+ double value; // The number for which we later need to create a HeapObject.
+ int offset; // The {buffer_} offset where we emitted a dummy that needs to
+ // get replaced by the actual HeapObject via
+ // {Assembler::set_heap_number}.
+ };
+ std::forward_list<RequestedHeapNumber> heap_numbers_;
};
« no previous file with comments | « src/arm64/macro-assembler-arm64-inl.h ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698