Skip to content

Commit a0ee291

Browse files
committed
V8: Reapply patches
1 parent 95c9305 commit a0ee291

File tree

6 files changed

+108
-78
lines changed

6 files changed

+108
-78
lines changed

deps/v8/build/common.gypi

+1-6
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@
259259
'WIN32',
260260
],
261261
'msvs_configuration_attributes': {
262-
'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
263262
'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
264263
'CharacterSet': '1',
265264
},
@@ -344,7 +343,7 @@
344343
},
345344
'conditions': [
346345
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
347-
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
346+
'cflags': [ '-Wno-unused-parameter',
348347
'-Wnon-virtual-dtor', '-Woverloaded-virtual' ],
349348
}],
350349
['OS=="android"', {
@@ -367,10 +366,6 @@
367366
'conditions': [
368367
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
369368
or OS=="android"', {
370-
'cflags!': [
371-
'-O2',
372-
'-Os',
373-
],
374369
'cflags': [
375370
'-fdata-sections',
376371
'-ffunction-sections',

deps/v8/src/gdb-jit.cc

+71-57
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131

3232
#include "bootstrapper.h"
3333
#include "compiler.h"
34+
#include "frames.h"
35+
#include "frames-inl.h"
3436
#include "global-handles.h"
3537
#include "messages.h"
36-
#include "platform.h"
3738
#include "natives.h"
38-
#include "scopeinfo.h"
39+
#include "platform.h"
40+
#include "scopes.h"
3941

4042
namespace v8 {
4143
namespace internal {
@@ -194,7 +196,7 @@ class DebugSectionBase : public ZoneObject {
194196

195197
virtual void WriteBody(Writer::Slot<THeader> header, Writer* writer) {
196198
uintptr_t start = writer->position();
197-
if (WriteBody(writer)) {
199+
if (WriteBodyInternal(writer)) {
198200
uintptr_t end = writer->position();
199201
header->offset = start;
200202
#if defined(__MACH_O)
@@ -204,7 +206,7 @@ class DebugSectionBase : public ZoneObject {
204206
}
205207
}
206208

207-
virtual bool WriteBody(Writer* writer) {
209+
virtual bool WriteBodyInternal(Writer* writer) {
208210
return false;
209211
}
210212

@@ -340,14 +342,14 @@ class ELFSection : public DebugSectionBase<ELFSectionHeader> {
340342

341343
virtual void WriteBody(Writer::Slot<Header> header, Writer* w) {
342344
uintptr_t start = w->position();
343-
if (WriteBody(w)) {
345+
if (WriteBodyInternal(w)) {
344346
uintptr_t end = w->position();
345347
header->offset = start;
346348
header->size = end - start;
347349
}
348350
}
349351

350-
virtual bool WriteBody(Writer* w) {
352+
virtual bool WriteBodyInternal(Writer* w) {
351353
return false;
352354
}
353355

@@ -627,9 +629,9 @@ class MachO BASE_EMBEDDED {
627629
#if defined(__ELF)
628630
class ELF BASE_EMBEDDED {
629631
public:
630-
ELF() : sections_(6) {
631-
sections_.Add(new ELFSection("", ELFSection::TYPE_NULL, 0));
632-
sections_.Add(new StringTable(".shstrtab"));
632+
ELF(Zone* zone) : sections_(6, zone) {
633+
sections_.Add(new(zone) ELFSection("", ELFSection::TYPE_NULL, 0), zone);
634+
sections_.Add(new(zone) StringTable(".shstrtab"), zone);
633635
}
634636

635637
void Write(Writer* w) {
@@ -642,8 +644,8 @@ class ELF BASE_EMBEDDED {
642644
return sections_[index];
643645
}
644646

645-
uint32_t AddSection(ELFSection* section) {
646-
sections_.Add(section);
647+
uint32_t AddSection(ELFSection* section, Zone* zone) {
648+
sections_.Add(section, zone);
647649
section->set_index(sections_.length() - 1);
648650
return sections_.length() - 1;
649651
}
@@ -675,7 +677,7 @@ class ELF BASE_EMBEDDED {
675677
{ 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
676678
#elif defined(V8_TARGET_ARCH_X64)
677679
const uint8_t ident[16] =
678-
{ 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0 , 0, 0, 0, 0, 0, 0};
680+
{ 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
679681
#else
680682
#error Unsupported target architecture.
681683
#endif
@@ -852,10 +854,10 @@ class ELFSymbol BASE_EMBEDDED {
852854

853855
class ELFSymbolTable : public ELFSection {
854856
public:
855-
explicit ELFSymbolTable(const char* name)
857+
ELFSymbolTable(const char* name, Zone* zone)
856858
: ELFSection(name, TYPE_SYMTAB, sizeof(uintptr_t)),
857-
locals_(1),
858-
globals_(1) {
859+
locals_(1, zone),
860+
globals_(1, zone) {
859861
}
860862

861863
virtual void WriteBody(Writer::Slot<Header> header, Writer* w) {
@@ -883,11 +885,11 @@ class ELFSymbolTable : public ELFSection {
883885
strtab->DetachWriter();
884886
}
885887

886-
void Add(const ELFSymbol& symbol) {
888+
void Add(const ELFSymbol& symbol, Zone* zone) {
887889
if (symbol.binding() == ELFSymbol::BIND_LOCAL) {
888-
locals_.Add(symbol);
890+
locals_.Add(symbol, zone);
889891
} else {
890-
globals_.Add(symbol);
892+
globals_.Add(symbol, zone);
891893
}
892894
}
893895

@@ -1019,26 +1021,29 @@ class CodeDescription BASE_EMBEDDED {
10191021
static void CreateSymbolsTable(CodeDescription* desc,
10201022
ELF* elf,
10211023
int text_section_index) {
1022-
ELFSymbolTable* symtab = new ELFSymbolTable(".symtab");
1023-
StringTable* strtab = new StringTable(".strtab");
1024+
Zone* zone = desc->info()->zone();
1025+
ELFSymbolTable* symtab = new(zone) ELFSymbolTable(".symtab", zone);
1026+
StringTable* strtab = new(zone) StringTable(".strtab");
10241027

10251028
// Symbol table should be followed by the linked string table.
1026-
elf->AddSection(symtab);
1027-
elf->AddSection(strtab);
1029+
elf->AddSection(symtab, zone);
1030+
elf->AddSection(strtab, zone);
10281031

10291032
symtab->Add(ELFSymbol("V8 Code",
10301033
0,
10311034
0,
10321035
ELFSymbol::BIND_LOCAL,
10331036
ELFSymbol::TYPE_FILE,
1034-
ELFSection::INDEX_ABSOLUTE));
1037+
ELFSection::INDEX_ABSOLUTE),
1038+
zone);
10351039

10361040
symtab->Add(ELFSymbol(desc->name(),
10371041
0,
10381042
desc->CodeSize(),
10391043
ELFSymbol::BIND_GLOBAL,
10401044
ELFSymbol::TYPE_FUNC,
1041-
text_section_index));
1045+
text_section_index),
1046+
zone);
10421047
}
10431048
#endif // defined(__ELF)
10441049

@@ -1074,7 +1079,7 @@ class DebugInfoSection : public DebugSection {
10741079
DW_ATE_SIGNED = 0x5
10751080
};
10761081

1077-
bool WriteBody(Writer* w) {
1082+
bool WriteBodyInternal(Writer* w) {
10781083
uintptr_t cu_start = w->position();
10791084
Writer::Slot<uint32_t> size = w->CreateSlotHere<uint32_t>();
10801085
uintptr_t start = w->position();
@@ -1094,8 +1099,7 @@ class DebugInfoSection : public DebugSection {
10941099
w->WriteString("v8value");
10951100

10961101
if (desc_->IsInfoAvailable()) {
1097-
CompilationInfo* info = desc_->info();
1098-
ScopeInfo<FreeStoreAllocationPolicy> scope_info(info->scope());
1102+
Scope* scope = desc_->info()->scope();
10991103
w->WriteULEB128(2);
11001104
w->WriteString(desc_->name());
11011105
w->Write<intptr_t>(desc_->CodeStart());
@@ -1106,23 +1110,27 @@ class DebugInfoSection : public DebugSection {
11061110
w->Write<uint8_t>(DW_OP_reg5); // The frame pointer's here on ia32
11071111
#elif defined(V8_TARGET_ARCH_X64)
11081112
w->Write<uint8_t>(DW_OP_reg6); // and here on x64.
1113+
#elif defined(V8_TARGET_ARCH_ARM)
1114+
UNIMPLEMENTED();
1115+
#elif defined(V8_TARGET_ARCH_MIPS)
1116+
UNIMPLEMENTED();
11091117
#else
11101118
#error Unsupported target architecture.
11111119
#endif
11121120
fb_block_size.set(static_cast<uint32_t>(w->position() - fb_block_start));
11131121

1114-
int params = scope_info.number_of_parameters();
1115-
int slots = scope_info.number_of_stack_slots();
1116-
int context_slots = scope_info.number_of_context_slots();
1122+
int params = scope->num_parameters();
1123+
int slots = scope->num_stack_slots();
1124+
int context_slots = scope->ContextLocalCount();
11171125
// The real slot ID is internal_slots + context_slot_id.
11181126
int internal_slots = Context::MIN_CONTEXT_SLOTS;
1119-
int locals = scope_info.LocalCount();
1127+
int locals = scope->StackLocalCount();
11201128
int current_abbreviation = 4;
11211129

11221130
for (int param = 0; param < params; ++param) {
11231131
w->WriteULEB128(current_abbreviation++);
11241132
w->WriteString(
1125-
*scope_info.ParameterName(param)->ToCString(DISALLOW_NULLS));
1133+
*scope->parameter(param)->name()->ToCString(DISALLOW_NULLS));
11261134
w->Write<uint32_t>(ty_offset);
11271135
Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>();
11281136
uintptr_t block_start = w->position();
@@ -1148,7 +1156,7 @@ class DebugInfoSection : public DebugSection {
11481156
ASSERT(Context::CLOSURE_INDEX == 0);
11491157
ASSERT(Context::PREVIOUS_INDEX == 1);
11501158
ASSERT(Context::EXTENSION_INDEX == 2);
1151-
ASSERT(Context::GLOBAL_INDEX == 3);
1159+
ASSERT(Context::GLOBAL_OBJECT_INDEX == 3);
11521160
w->WriteULEB128(current_abbreviation++);
11531161
w->WriteString(".closure");
11541162
w->WriteULEB128(current_abbreviation++);
@@ -1167,10 +1175,13 @@ class DebugInfoSection : public DebugSection {
11671175
w->WriteString(builder.Finalize());
11681176
}
11691177

1178+
ZoneList<Variable*> stack_locals(locals, scope->zone());
1179+
ZoneList<Variable*> context_locals(context_slots, scope->zone());
1180+
scope->CollectStackAndContextLocals(&stack_locals, &context_locals);
11701181
for (int local = 0; local < locals; ++local) {
11711182
w->WriteULEB128(current_abbreviation++);
11721183
w->WriteString(
1173-
*scope_info.LocalName(local)->ToCString(DISALLOW_NULLS));
1184+
*stack_locals[local]->name()->ToCString(DISALLOW_NULLS));
11741185
w->Write<uint32_t>(ty_offset);
11751186
Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>();
11761187
uintptr_t block_start = w->position();
@@ -1287,7 +1298,7 @@ class DebugAbbrevSection : public DebugSection {
12871298
w->WriteULEB128(0);
12881299
}
12891300

1290-
bool WriteBody(Writer* w) {
1301+
bool WriteBodyInternal(Writer* w) {
12911302
int current_abbreviation = 1;
12921303
bool extra_info = desc_->IsInfoAvailable();
12931304
ASSERT(desc_->IsLineInfoAvailable());
@@ -1306,14 +1317,13 @@ class DebugAbbrevSection : public DebugSection {
13061317
w->WriteULEB128(0);
13071318

13081319
if (extra_info) {
1309-
CompilationInfo* info = desc_->info();
1310-
ScopeInfo<FreeStoreAllocationPolicy> scope_info(info->scope());
1311-
int params = scope_info.number_of_parameters();
1312-
int slots = scope_info.number_of_stack_slots();
1313-
int context_slots = scope_info.number_of_context_slots();
1320+
Scope* scope = desc_->info()->scope();
1321+
int params = scope->num_parameters();
1322+
int slots = scope->num_stack_slots();
1323+
int context_slots = scope->ContextLocalCount();
13141324
// The real slot ID is internal_slots + context_slot_id.
13151325
int internal_slots = Context::MIN_CONTEXT_SLOTS;
1316-
int locals = scope_info.LocalCount();
1326+
int locals = scope->StackLocalCount();
13171327
int total_children =
13181328
params + slots + context_slots + internal_slots + locals + 2;
13191329

@@ -1418,7 +1428,7 @@ class DebugLineSection : public DebugSection {
14181428
DW_LNE_DEFINE_FILE = 3
14191429
};
14201430

1421-
bool WriteBody(Writer* w) {
1431+
bool WriteBodyInternal(Writer* w) {
14221432
// Write prologue.
14231433
Writer::Slot<uint32_t> total_length = w->CreateSlotHere<uint32_t>();
14241434
uintptr_t start = w->position();
@@ -1558,7 +1568,7 @@ class DebugLineSection : public DebugSection {
15581568
class UnwindInfoSection : public DebugSection {
15591569
public:
15601570
explicit UnwindInfoSection(CodeDescription* desc);
1561-
virtual bool WriteBody(Writer* w);
1571+
virtual bool WriteBodyInternal(Writer* w);
15621572

15631573
int WriteCIE(Writer* w);
15641574
void WriteFDE(Writer* w, int);
@@ -1770,7 +1780,7 @@ void UnwindInfoSection::WriteFDEStateAfterRBPPop(Writer* w) {
17701780
}
17711781

17721782

1773-
bool UnwindInfoSection::WriteBody(Writer* w) {
1783+
bool UnwindInfoSection::WriteBodyInternal(Writer* w) {
17741784
uint32_t cie_position = WriteCIE(w);
17751785
WriteFDE(w, cie_position);
17761786
return true;
@@ -1780,13 +1790,14 @@ bool UnwindInfoSection::WriteBody(Writer* w) {
17801790
#endif // V8_TARGET_ARCH_X64
17811791

17821792
static void CreateDWARFSections(CodeDescription* desc, DebugObject* obj) {
1793+
Zone* zone = desc->info()->zone();
17831794
if (desc->IsLineInfoAvailable()) {
1784-
obj->AddSection(new DebugInfoSection(desc));
1785-
obj->AddSection(new DebugAbbrevSection(desc));
1786-
obj->AddSection(new DebugLineSection(desc));
1795+
obj->AddSection(new(zone) DebugInfoSection(desc), zone);
1796+
obj->AddSection(new(zone) DebugAbbrevSection(desc), zone);
1797+
obj->AddSection(new(zone) DebugLineSection(desc), zone);
17871798
}
17881799
#ifdef V8_TARGET_ARCH_X64
1789-
obj->AddSection(new UnwindInfoSection(desc));
1800+
obj->AddSection(new(zone) UnwindInfoSection(desc), zone);
17901801
#endif
17911802
}
17921803

@@ -1905,7 +1916,8 @@ static void UnregisterCodeEntry(JITCodeEntry* entry) {
19051916

19061917

19071918
static JITCodeEntry* CreateELFObject(CodeDescription* desc) {
1908-
ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
1919+
Zone* zone = desc->info()->zone();
1920+
ZoneScope zone_scope(zone, DELETE_ON_EXIT);
19091921
#ifdef __MACH_O
19101922
MachO mach_o;
19111923
Writer w(&mach_o);
@@ -1918,17 +1930,19 @@ static JITCodeEntry* CreateELFObject(CodeDescription* desc) {
19181930

19191931
mach_o.Write(&w, desc->CodeStart(), desc->CodeSize());
19201932
#else
1921-
ELF elf;
1933+
ELF elf(zone);
19221934
Writer w(&elf);
19231935

19241936
int text_section_index = elf.AddSection(
1925-
new FullHeaderELFSection(".text",
1926-
ELFSection::TYPE_NOBITS,
1927-
kCodeAlignment,
1928-
desc->CodeStart(),
1929-
0,
1930-
desc->CodeSize(),
1931-
ELFSection::FLAG_ALLOC | ELFSection::FLAG_EXEC));
1937+
new(zone) FullHeaderELFSection(
1938+
".text",
1939+
ELFSection::TYPE_NOBITS,
1940+
kCodeAlignment,
1941+
desc->CodeStart(),
1942+
0,
1943+
desc->CodeSize(),
1944+
ELFSection::FLAG_ALLOC | ELFSection::FLAG_EXEC),
1945+
zone);
19321946

19331947
CreateSymbolsTable(desc, &elf, text_section_index);
19341948

deps/v8/src/mark-compact.cc

+5-7
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ bool MarkCompactCollector::StartCompaction(CompactionMode mode) {
340340
if (!compacting_) {
341341
ASSERT(evacuation_candidates_.length() == 0);
342342

343+
#ifdef ENABLE_GDB_JIT_INTERFACE
344+
// If GDBJIT interface is active disable compaction.
345+
if (FLAG_gdbjit) return false;
346+
#endif
347+
343348
CollectEvacuationCandidates(heap()->old_pointer_space());
344349
CollectEvacuationCandidates(heap()->old_data_space());
345350

@@ -777,13 +782,6 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) {
777782

778783
ASSERT(!FLAG_never_compact || !FLAG_always_compact);
779784

780-
#ifdef ENABLE_GDB_JIT_INTERFACE
781-
if (FLAG_gdbjit) {
782-
// If GDBJIT interface is active disable compaction.
783-
compacting_collection_ = false;
784-
}
785-
#endif
786-
787785
// Clear marking bits if incremental marking is aborted.
788786
if (was_marked_incrementally_ && abort_incremental_marking_) {
789787
heap()->incremental_marking()->Abort();

0 commit comments

Comments
 (0)