summaryrefslogtreecommitdiff
path: root/deps/v8/src/codegen/assembler.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-08-16 11:32:46 +0200
committerMichaël Zasso <targos@protonmail.com>2019-08-19 09:25:23 +0200
commite31f0a7d25668d3c1531294d2ef44a9f3bde4ef4 (patch)
tree6c6bed9804be9df6162b2483f0a56f371f66464d /deps/v8/src/codegen/assembler.h
parentec16fdae540adaf710b1a86c620170b2880088f0 (diff)
downloadnode-new-e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4.tar.gz
deps: update V8 to 7.7.299.4
PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/v8/src/codegen/assembler.h')
-rw-r--r--deps/v8/src/codegen/assembler.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/deps/v8/src/codegen/assembler.h b/deps/v8/src/codegen/assembler.h
index eae5d53a4f..98639583d8 100644
--- a/deps/v8/src/codegen/assembler.h
+++ b/deps/v8/src/codegen/assembler.h
@@ -36,7 +36,9 @@
#define V8_CODEGEN_ASSEMBLER_H_
#include <forward_list>
+#include <unordered_map>
+#include "src/base/memory.h"
#include "src/codegen/code-comments.h"
#include "src/codegen/cpu-features.h"
#include "src/codegen/external-reference.h"
@@ -55,6 +57,10 @@ class ApiFunction;
namespace internal {
+using base::Memory;
+using base::ReadUnalignedValue;
+using base::WriteUnalignedValue;
+
// Forward declarations.
class EmbeddedData;
class InstructionStream;
@@ -155,7 +161,7 @@ struct V8_EXPORT_PRIVATE AssemblerOptions {
bool isolate_independent_code = false;
// Enables the use of isolate-independent builtins through an off-heap
// trampoline. (macro assembler feature).
- bool inline_offheap_trampolines = false;
+ bool inline_offheap_trampolines = FLAG_embedded_builtins;
// On some platforms, all code is within a given range in the process,
// and the start of this range is configured here.
Address code_range_start = 0;
@@ -272,8 +278,11 @@ class V8_EXPORT_PRIVATE AssemblerBase : public Malloced {
int AddCodeTarget(Handle<Code> target);
Handle<Code> GetCodeTarget(intptr_t code_target_index) const;
- int AddCompressedEmbeddedObject(Handle<HeapObject> object);
- Handle<HeapObject> GetCompressedEmbeddedObject(intptr_t index) const;
+ // Add 'object' to the {embedded_objects_} vector and return the index at
+ // which it is stored.
+ using EmbeddedObjectIndex = size_t;
+ EmbeddedObjectIndex AddEmbeddedObject(Handle<HeapObject> object);
+ Handle<HeapObject> GetEmbeddedObject(EmbeddedObjectIndex index) const;
// The buffer into which code and relocation info are generated.
std::unique_ptr<AssemblerBuffer> buffer_;
@@ -321,12 +330,18 @@ class V8_EXPORT_PRIVATE AssemblerBase : public Malloced {
// the code handle in the vector instead.
std::vector<Handle<Code>> code_targets_;
- // When pointer compression is enabled, we need to store indexes to this
- // table in the code until we are ready to copy the code and embed the real
- // object pointers. We don't need to do the same thing for non-compressed
- // embedded objects, because we've got enough space (kPointerSize) in the
- // code stream to just embed the address of the object handle.
- std::vector<Handle<HeapObject>> compressed_embedded_objects_;
+ // If an assembler needs a small number to refer to a heap object handle
+ // (for example, because there are only 32bit available on a 64bit arch), the
+ // assembler adds the object into this vector using AddEmbeddedObject, and
+ // may then refer to the heap object using the handle's index in this vector.
+ std::vector<Handle<HeapObject>> embedded_objects_;
+
+ // Embedded objects are deduplicated based on handle location. This is a
+ // compromise that is almost as effective as deduplication based on actual
+ // heap object addresses maintains GC safety.
+ std::unordered_map<Handle<HeapObject>, EmbeddedObjectIndex,
+ Handle<HeapObject>::hash, Handle<HeapObject>::equal_to>
+ embedded_objects_map_;
const AssemblerOptions options_;
uint64_t enabled_cpu_features_;