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

Unified Diff: src/objects-inl.h

Issue 3156028: Change code pointer in function objects to a pointer to the first... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 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/objects.cc ('k') | src/serialize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
===================================================================
--- src/objects-inl.h (revision 5298)
+++ src/objects-inl.h (working copy)
@@ -35,9 +35,10 @@
#ifndef V8_OBJECTS_INL_H_
#define V8_OBJECTS_INL_H_
-#include "objects.h"
+#include "memory.h"
#include "contexts.h"
#include "conversions-inl.h"
+#include "objects.h"
#include "property.h"
namespace v8 {
@@ -2402,6 +2403,12 @@
}
+Object* Code::GetObjectFromEntryAddress(Address location_of_address) {
+ return HeapObject::
+ FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize);
+}
+
+
Object* Map::prototype() {
return READ_FIELD(this, kPrototypeOffset);
}
@@ -2731,19 +2738,21 @@
Code* JSFunction::code() {
- return Code::cast(READ_FIELD(this, kCodeOffset));
+ return Code::cast(unchecked_code());
}
Code* JSFunction::unchecked_code() {
- return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset));
+ return reinterpret_cast<Code*>(
+ Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset)));
}
void JSFunction::set_code(Code* value) {
// Skip the write barrier because code is never in new space.
ASSERT(!Heap::InNewSpace(value));
- WRITE_FIELD(this, kCodeOffset, value);
+ Address entry = value->entry();
+ WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry));
}
« no previous file with comments | « src/objects.cc ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698