Commit 29bcccb4 authored by whesse@chromium.org's avatar whesse@chromium.org

X64 Implementation: Implement Generate_Function(Call,Apply)

Review URL: http://codereview.chromium.org/147205

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2287 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b9995e03
...@@ -654,6 +654,12 @@ Object* Object::GetProperty(String* key, PropertyAttributes* attributes) { ...@@ -654,6 +654,12 @@ Object* Object::GetProperty(String* key, PropertyAttributes* attributes) {
#define WRITE_INT_FIELD(p, offset, value) \ #define WRITE_INT_FIELD(p, offset, value) \
(*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value) (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value)
#define READ_INTPTR_FIELD(p, offset) \
(*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)))
#define WRITE_INTPTR_FIELD(p, offset, value) \
(*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_UINT32_FIELD(p, offset) \ #define READ_UINT32_FIELD(p, offset) \
(*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)))
...@@ -2303,12 +2309,12 @@ void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id, ...@@ -2303,12 +2309,12 @@ void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id,
Address Proxy::proxy() { Address Proxy::proxy() {
return AddressFrom<Address>(READ_INT_FIELD(this, kProxyOffset)); return AddressFrom<Address>(READ_INTPTR_FIELD(this, kProxyOffset));
} }
void Proxy::set_proxy(Address value) { void Proxy::set_proxy(Address value) {
WRITE_INT_FIELD(this, kProxyOffset, OffsetFrom(value)); WRITE_INTPTR_FIELD(this, kProxyOffset, OffsetFrom(value));
} }
......
This diff is collapsed.
...@@ -2301,7 +2301,8 @@ void CodeGenerator::VisitAssignment(Assignment* node) { ...@@ -2301,7 +2301,8 @@ void CodeGenerator::VisitAssignment(Assignment* node) {
// the target, with an implicit promise that it will be written to again // the target, with an implicit promise that it will be written to again
// before it is read. // before it is read.
// TODO(X64): Implement TakeValue optimization. // TODO(X64): Implement TakeValue optimization.
if (false && literal != NULL || (right_var != NULL && right_var != var)) { if (false) {
// if (literal != NULL || (right_var != NULL && right_var != var)) {
// target.TakeValue(NOT_INSIDE_TYPEOF); // target.TakeValue(NOT_INSIDE_TYPEOF);
} else { } else {
target.GetValue(NOT_INSIDE_TYPEOF); target.GetValue(NOT_INSIDE_TYPEOF);
...@@ -3342,7 +3343,9 @@ void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) { ...@@ -3342,7 +3343,9 @@ void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* a) { void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* a) {
UNIMPLEMENTED(); // TODO(X64): Implement this function.
// Ignore arguments and return undefined, to signal failure.
frame_->Push(Factory::undefined_value());
} }
...@@ -3371,10 +3374,27 @@ void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) { ...@@ -3371,10 +3374,27 @@ void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) {
} }
void CodeGenerator::GenerateLog(ZoneList<Expression*>* a) { void CodeGenerator::GenerateLog(ZoneList<Expression*>* args) {
UNIMPLEMENTED(); // Conditionally generate a log call.
// Args:
// 0 (literal string): The type of logging (corresponds to the flags).
// This is used to determine whether or not to generate the log call.
// 1 (string): Format string. Access the string at argument index 2
// with '%2s' (see Logger::LogRuntime for all the formats).
// 2 (array): Arguments to the format string.
ASSERT_EQ(args->length(), 3);
#ifdef ENABLE_LOGGING_AND_PROFILING
if (ShouldGenerateLog(args->at(0))) {
Load(args->at(1));
Load(args->at(2));
frame_->CallRuntime(Runtime::kLog, 2);
}
#endif
// Finally, we're expected to leave a value on the top of the stack.
frame_->Push(Factory::undefined_value());
} }
void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* args) { void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* args) {
ASSERT(args->length() == 2); ASSERT(args->length() == 2);
...@@ -3446,9 +3466,29 @@ void CodeGenerator::GenerateSetValueOf(ZoneList<Expression*>* args) { ...@@ -3446,9 +3466,29 @@ void CodeGenerator::GenerateSetValueOf(ZoneList<Expression*>* args) {
void CodeGenerator::GenerateValueOf(ZoneList<Expression*>* args) { void CodeGenerator::GenerateValueOf(ZoneList<Expression*>* args) {
UNIMPLEMENTED(); ASSERT(args->length() == 1);
JumpTarget leave;
Load(args->at(0)); // Load the object.
frame_->Dup();
Result object = frame_->Pop();
object.ToRegister();
ASSERT(object.is_valid());
// if (object->IsSmi()) return object.
__ testl(object.reg(), Immediate(kSmiTagMask));
leave.Branch(zero);
// It is a heap object - get map.
Result temp = allocator()->Allocate();
ASSERT(temp.is_valid());
// if (!object->IsJSValue()) return object.
__ CmpObjectType(object.reg(), JS_VALUE_TYPE, temp.reg());
leave.Branch(not_equal);
__ movq(temp.reg(), FieldOperand(object.reg(), JSValue::kValueOffset));
object.Unuse();
frame_->SetElementAt(0, &temp);
leave.Bind();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// CodeGenerator implementation of Expressions // CodeGenerator implementation of Expressions
......
...@@ -79,10 +79,12 @@ void KeyedLoadIC::Generate(MacroAssembler* masm, ...@@ -79,10 +79,12 @@ void KeyedLoadIC::Generate(MacroAssembler* masm,
void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC0AB)); // Debugging aid.
} }
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC1AB)); // Debugging aid.
} }
bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) {
...@@ -162,10 +164,12 @@ void KeyedStoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) { ...@@ -162,10 +164,12 @@ void KeyedStoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) {
void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC2AB)); // Debugging aid.
} }
void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC3AB)); // Debugging aid.
} }
Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
...@@ -265,26 +269,32 @@ void LoadIC::Generate(MacroAssembler* masm, ExternalReference const& f) { ...@@ -265,26 +269,32 @@ void LoadIC::Generate(MacroAssembler* masm, ExternalReference const& f) {
void LoadIC::GenerateArrayLength(MacroAssembler* masm) { void LoadIC::GenerateArrayLength(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC4AB)); // Debugging aid.
} }
void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC5AB)); // Debugging aid.
} }
void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC6AB)); // Debugging aid.
} }
void LoadIC::GenerateMiss(MacroAssembler* masm) { void LoadIC::GenerateMiss(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC7AB)); // Debugging aid.
} }
void LoadIC::GenerateNormal(MacroAssembler* masm) { void LoadIC::GenerateNormal(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC8AB)); // Debugging aid.
} }
void LoadIC::GenerateStringLength(MacroAssembler* masm) { void LoadIC::GenerateStringLength(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xC9AB)); // Debugging aid.
} }
bool LoadIC::PatchInlinedLoad(Address address, Object* map, int index) { bool LoadIC::PatchInlinedLoad(Address address, Object* map, int index) {
...@@ -312,10 +322,12 @@ void StoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) { ...@@ -312,10 +322,12 @@ void StoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) {
void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { void StoreIC::GenerateExtendStorage(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xCAAB)); // Debugging aid.
} }
void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
masm->int3(); // UNIMPLEMENTED. masm->int3(); // UNIMPLEMENTED.
masm->movq(kScratchRegister, Immediate(0xCBAB)); // Debugging aid.
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment