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

Unified Diff: src/objects.h

Issue 7623011: Implement function proxies (except for their use as constructors). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed second round of comments. Created 9 years, 3 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/messages.js ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index ff13aedcce6f9ba667cccbcdc20b8fd49f4c3f2e..792eff13b7de5da41ca52d399ccd3d6c433218f4 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4718,7 +4718,7 @@ class SharedFunctionInfo: public HeapObject {
DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters)
// Indicates whether the function is a native function.
- // These needs special threatment in .call and .apply since
+ // These needs special treatment in .call and .apply since
// null passed as the receiver should not be translated to the
// global object.
DECL_BOOLEAN_ACCESSORS(native)
@@ -4985,7 +4985,7 @@ class JSFunction: public JSObject {
// [prototype_or_initial_map]:
DECL_ACCESSORS(prototype_or_initial_map, Object)
- // [shared_function_info]: The information about the function that
+ // [shared]: The information about the function that
// can be shared by instances.
DECL_ACCESSORS(shared, SharedFunctionInfo)
@@ -6584,9 +6584,6 @@ class JSProxy: public JSReceiver {
// [handler]: The handler property.
DECL_ACCESSORS(handler, Object)
- // [padding]: The padding slot (unused, see below).
- DECL_ACCESSORS(padding, Object)
-
// Casting.
static inline JSProxy* cast(Object* obj);
@@ -6610,6 +6607,9 @@ class JSProxy: public JSReceiver {
// Turn this into an (empty) JSObject.
void Fix();
+ // Initializes the body after the handler slot.
+ inline void InitializeBody(int object_size, Object* value);
+
// Dispatched behavior.
#ifdef OBJECT_PRINT
inline void JSProxyPrint() {
@@ -6626,9 +6626,11 @@ class JSProxy: public JSReceiver {
// upon freeze.
static const int kHandlerOffset = HeapObject::kHeaderSize;
static const int kPaddingOffset = kHandlerOffset + kPointerSize;
- static const int kSize = kPaddingOffset + kPointerSize;
+ static const int kSize = JSObject::kHeaderSize;
+ static const int kHeaderSize = kPaddingOffset;
+ static const int kPaddingSize = kSize - kPaddingOffset;
- STATIC_CHECK(kSize == JSObject::kHeaderSize);
+ STATIC_CHECK(kPaddingSize >= 0);
typedef FixedBodyDescriptor<kHandlerOffset,
kHandlerOffset + kPointerSize,
@@ -6639,12 +6641,41 @@ class JSProxy: public JSReceiver {
};
-// TODO(rossberg): Only a stub for now.
class JSFunctionProxy: public JSProxy {
public:
+ // [call_trap]: The call trap.
+ DECL_ACCESSORS(call_trap, Object)
+
+ // [construct_trap]: The construct trap.
+ DECL_ACCESSORS(construct_trap, Object)
+
// Casting.
static inline JSFunctionProxy* cast(Object* obj);
+ // Dispatched behavior.
+#ifdef OBJECT_PRINT
+ inline void JSFunctionProxyPrint() {
+ JSFunctionProxyPrint(stdout);
+ }
+ void JSFunctionProxyPrint(FILE* out);
+#endif
+#ifdef DEBUG
+ void JSFunctionProxyVerify();
+#endif
+
+ // Layout description.
+ static const int kCallTrapOffset = kHandlerOffset + kPointerSize;
+ static const int kConstructTrapOffset = kCallTrapOffset + kPointerSize;
+ static const int kPaddingOffset = kConstructTrapOffset + kPointerSize;
+ static const int kSize = JSFunction::kSize;
+ static const int kPaddingSize = kSize - kPaddingOffset;
+
+ STATIC_CHECK(kPaddingSize >= 0);
+
+ typedef FixedBodyDescriptor<kHandlerOffset,
+ kConstructTrapOffset + kPointerSize,
+ kSize> BodyDescriptor;
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy);
};
« no previous file with comments | « src/messages.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698