Revision: 6350
Author: [email protected]
Date: Mon Jan 17 05:11:39 2011
Log: Enable compilation of very simple functions in x64 crankshaft.
This change includes support for safepointtables and adding deoptimization
info (but not for deoptimizing).
Implemented crankshaft functions:
CallCode
GenerateSafepointTable
RegisterEnvironmentForDeoptimization
EmitGoto
This change allows us to compile very simple functions with crankshaft:
An empty function
A function returning a constant.
A function returning a parameter.
There is 6 disabled tests that require us to be able to deoptimize
which is currently not supported.
Review URL: http://codereview.chromium.org/6310009
http://code.google.com/p/v8/source/detail?r=6350
Modified:
/branches/bleeding_edge/src/x64/assembler-x64.cc
/branches/bleeding_edge/src/x64/assembler-x64.h
/branches/bleeding_edge/src/x64/deoptimizer-x64.cc
/branches/bleeding_edge/src/x64/frames-x64.h
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/test/cctest/cctest.status
/branches/bleeding_edge/test/mjsunit/mjsunit.status
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.cc Thu Jan 13 02:04:02
2011
+++ /branches/bleeding_edge/src/x64/assembler-x64.cc Mon Jan 17 05:11:39
2011
@@ -2948,6 +2948,12 @@
void Assembler::emit_sse_operand(Register dst, XMMRegister src) {
emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
}
+
+
+void Assembler::db(uint8_t data) {
+ EnsureSpace ensure_space(this);
+ emit(data);
+}
void Assembler::dd(uint32_t data) {
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h Fri Jan 14 06:03:05 2011
+++ /branches/bleeding_edge/src/x64/assembler-x64.h Mon Jan 17 05:11:39 2011
@@ -1261,7 +1261,7 @@
// Writes a single word of data in the code stream.
// Used for inline tables, e.g., jump-tables.
- void db(uint8_t data) { UNIMPLEMENTED(); }
+ void db(uint8_t data);
void dd(uint32_t data);
int pc_offset() const { return static_cast<int>(pc_ - buffer_); }
=======================================
--- /branches/bleeding_edge/src/x64/deoptimizer-x64.cc Thu Jan 13 06:10:26
2011
+++ /branches/bleeding_edge/src/x64/deoptimizer-x64.cc Mon Jan 17 05:11:39
2011
@@ -41,7 +41,8 @@
int Deoptimizer::table_entry_size_ = 10;
void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
- UNIMPLEMENTED();
+ // UNIMPLEMENTED, for now just return.
+ return;
}
@@ -68,7 +69,8 @@
void Deoptimizer::EntryGenerator::Generate() {
- UNIMPLEMENTED();
+ // UNIMPLEMENTED, for now just return.
+ return;
}
=======================================
--- /branches/bleeding_edge/src/x64/frames-x64.h Tue Dec 7 03:31:57 2010
+++ /branches/bleeding_edge/src/x64/frames-x64.h Mon Jan 17 05:11:39 2011
@@ -45,7 +45,7 @@
// Number of registers for which space is reserved in safepoints.
// TODO(x64): This should not be 0.
-static const int kNumSafepointRegisters = 0;
+static const int kNumSafepointRegisters = 8;
// ----------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Jan 17
03:25:36 2011
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Jan 17
05:11:39 2011
@@ -338,8 +338,9 @@
bool LCodeGen::GenerateSafepointTable() {
- Abort("Unimplemented: %s", "GeneratePrologue");
- return false;
+ ASSERT(is_done());
+ safepoints_.Emit(masm(), StackSlotCount());
+ return !is_aborted();
}
@@ -492,7 +493,24 @@
void LCodeGen::CallCode(Handle<Code> code,
RelocInfo::Mode mode,
LInstruction* instr) {
- Abort("Unimplemented: %s", "CallCode");
+ if (instr != NULL) {
+ LPointerMap* pointers = instr->pointer_map();
+ RecordPosition(pointers->position());
+ __ call(code, mode);
+ RegisterLazyDeoptimization(instr);
+ } else {
+ LPointerMap no_pointers(0);
+ RecordPosition(no_pointers.position());
+ __ call(code, mode);
+ RecordSafepoint(&no_pointers, Safepoint::kNoDeoptimizationIndex);
+ }
+
+ // Signal that we don't inline smi code before these stubs in the
+ // optimizing code generator.
+ if (code->kind() == Code::TYPE_RECORDING_BINARY_OP_IC ||
+ code->kind() == Code::COMPARE_IC) {
+ __ nop();
+ }
}
@@ -521,7 +539,30 @@
void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment*
environment) {
- Abort("Unimplemented: %s", "RegisterEnvironmentForDeoptimization");
+ if (!environment->HasBeenRegistered()) {
+ // Physical stack frame layout:
+ // -x ............. -4 0 ..................................... y
+ // [incoming arguments] [spill slots] [pushed outgoing arguments]
+
+ // Layout of the environment:
+ // 0 ..................................................... size-1
+ // [parameters] [locals] [expression stack including arguments]
+
+ // Layout of the translation:
+ // 0 ........................................................ size - 1
+ 4
+ // [expression stack including arguments] [locals] [4 words]
[parameters]
+ // |>------------ translation_size ------------<|
+
+ int frame_count = 0;
+ for (LEnvironment* e = environment; e != NULL; e = e->outer()) {
+ ++frame_count;
+ }
+ Translation translation(&translations_, frame_count);
+ WriteTranslation(environment, &translation);
+ int deoptimization_index = deoptimizations_.length();
+ environment->Register(deoptimization_index, translation.index());
+ deoptimizations_.Add(environment);
+ }
}
@@ -859,7 +900,19 @@
void LCodeGen::EmitGoto(int block, LDeferredCode* deferred_stack_check) {
- Abort("Unimplemented: %s", "EmitGoto");
+ block = chunk_->LookupDestination(block);
+ int next_block = GetNextEmittedBlock(current_block_);
+ if (block != next_block) {
+ // Perform stack overflow check if this goto needs it before jumping.
+ if (deferred_stack_check != NULL) {
+ __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
+ __ j(above_equal, chunk_->GetAssemblyLabel(block));
+ __ jmp(deferred_stack_check->entry());
+ deferred_stack_check->SetExit(chunk_->GetAssemblyLabel(block));
+ } else {
+ __ jmp(chunk_->GetAssemblyLabel(block));
+ }
+ }
}
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.status Mon Jan 17 00:11:03
2011
+++ /branches/bleeding_edge/test/cctest/cctest.status Mon Jan 17 05:11:39
2011
@@ -77,6 +77,12 @@
# Tests that time out with crankshaft.
test-api/Threading: SKIP
+# BUG(1049): Currently no deoptimization support.
+test-serialize/ContextSerialization: SKIP
+test-serialize/ContextDeserialization: SKIP
+test-debug/BreakPointReturn: SKIP
+test-debug/DebugStepLinearMixedICs: SKIP
+
##############################################################################
[ $arch == arm ]
=======================================
--- /branches/bleeding_edge/test/mjsunit/mjsunit.status Fri Jan 7 05:53:20
2011
+++ /branches/bleeding_edge/test/mjsunit/mjsunit.status Mon Jan 17 05:11:39
2011
@@ -119,6 +119,9 @@
# BUG (1026) This test is currently flaky.
compiler/simple-osr: SKIP
+# BUG(1049): Currently no deoptimization support.
+debug-liveedit-newsource: SKIP
+debug-liveedit-1: SKIP
##############################################################################
[ $arch == mips ]
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev