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

Side by Side Diff: include/v8.h

Issue 10069050: Add isolate accessor to AccessorInfo and Arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Daniel Clifford. Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/apiutils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 class Signature; 100 class Signature;
101 template <class T> class Handle; 101 template <class T> class Handle;
102 template <class T> class Local; 102 template <class T> class Local;
103 template <class T> class Persistent; 103 template <class T> class Persistent;
104 class FunctionTemplate; 104 class FunctionTemplate;
105 class ObjectTemplate; 105 class ObjectTemplate;
106 class Data; 106 class Data;
107 class AccessorInfo; 107 class AccessorInfo;
108 class StackTrace; 108 class StackTrace;
109 class StackFrame; 109 class StackFrame;
110 class Isolate;
110 111
111 namespace internal { 112 namespace internal {
112 113
113 class Arguments; 114 class Arguments;
114 class Object; 115 class Object;
115 class Heap; 116 class Heap;
116 class HeapObject; 117 class HeapObject;
117 class Isolate; 118 class Isolate;
118 } 119 }
119 120
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 */ 1961 */
1961 class Arguments { 1962 class Arguments {
1962 public: 1963 public:
1963 inline int Length() const; 1964 inline int Length() const;
1964 inline Local<Value> operator[](int i) const; 1965 inline Local<Value> operator[](int i) const;
1965 inline Local<Function> Callee() const; 1966 inline Local<Function> Callee() const;
1966 inline Local<Object> This() const; 1967 inline Local<Object> This() const;
1967 inline Local<Object> Holder() const; 1968 inline Local<Object> Holder() const;
1968 inline bool IsConstructCall() const; 1969 inline bool IsConstructCall() const;
1969 inline Local<Value> Data() const; 1970 inline Local<Value> Data() const;
1971 inline Isolate* GetIsolate() const;
1970 private: 1972 private:
1971 static const int kDataIndex = 0; 1973 static const int kIsolateIndex = 0;
1972 static const int kCalleeIndex = -1; 1974 static const int kDataIndex = -1;
1973 static const int kHolderIndex = -2; 1975 static const int kCalleeIndex = -2;
1976 static const int kHolderIndex = -3;
1974 1977
1975 friend class ImplementationUtilities; 1978 friend class ImplementationUtilities;
1976 inline Arguments(internal::Object** implicit_args, 1979 inline Arguments(internal::Object** implicit_args,
1977 internal::Object** values, 1980 internal::Object** values,
1978 int length, 1981 int length,
1979 bool is_construct_call); 1982 bool is_construct_call);
1980 internal::Object** implicit_args_; 1983 internal::Object** implicit_args_;
1981 internal::Object** values_; 1984 internal::Object** values_;
1982 int length_; 1985 int length_;
1983 bool is_construct_call_; 1986 bool is_construct_call_;
1984 }; 1987 };
1985 1988
1986 1989
1987 /** 1990 /**
1988 * The information passed to an accessor callback about the context 1991 * The information passed to an accessor callback about the context
1989 * of the property access. 1992 * of the property access.
1990 */ 1993 */
1991 class V8EXPORT AccessorInfo { 1994 class V8EXPORT AccessorInfo {
1992 public: 1995 public:
1993 inline AccessorInfo(internal::Object** args) 1996 inline AccessorInfo(internal::Object** args)
1994 : args_(args) { } 1997 : args_(args) { }
1998 inline Isolate* GetIsolate() const;
1995 inline Local<Value> Data() const; 1999 inline Local<Value> Data() const;
1996 inline Local<Object> This() const; 2000 inline Local<Object> This() const;
1997 inline Local<Object> Holder() const; 2001 inline Local<Object> Holder() const;
1998 private: 2002 private:
1999 internal::Object** args_; 2003 internal::Object** args_;
2000 }; 2004 };
2001 2005
2002 2006
2003 typedef Handle<Value> (*InvocationCallback)(const Arguments& args); 2007 typedef Handle<Value> (*InvocationCallback)(const Arguments& args);
2004 2008
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after
4041 return Local<Object>(reinterpret_cast<Object*>( 4045 return Local<Object>(reinterpret_cast<Object*>(
4042 &implicit_args_[kHolderIndex])); 4046 &implicit_args_[kHolderIndex]));
4043 } 4047 }
4044 4048
4045 4049
4046 Local<Value> Arguments::Data() const { 4050 Local<Value> Arguments::Data() const {
4047 return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex])); 4051 return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex]));
4048 } 4052 }
4049 4053
4050 4054
4055 Isolate* Arguments::GetIsolate() const {
4056 return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
4057 }
4058
4059
4051 bool Arguments::IsConstructCall() const { 4060 bool Arguments::IsConstructCall() const {
4052 return is_construct_call_; 4061 return is_construct_call_;
4053 } 4062 }
4054 4063
4055 4064
4056 int Arguments::Length() const { 4065 int Arguments::Length() const {
4057 return length_; 4066 return length_;
4058 } 4067 }
4059 4068
4060 4069
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
4276 4285
4277 4286
4278 External* External::Cast(v8::Value* value) { 4287 External* External::Cast(v8::Value* value) {
4279 #ifdef V8_ENABLE_CHECKS 4288 #ifdef V8_ENABLE_CHECKS
4280 CheckCast(value); 4289 CheckCast(value);
4281 #endif 4290 #endif
4282 return static_cast<External*>(value); 4291 return static_cast<External*>(value);
4283 } 4292 }
4284 4293
4285 4294
4295 Isolate* AccessorInfo::GetIsolate() const {
4296 return *reinterpret_cast<Isolate**>(&args_[-3]);
4297 }
4298
4299
4286 Local<Value> AccessorInfo::Data() const { 4300 Local<Value> AccessorInfo::Data() const {
4287 return Local<Value>(reinterpret_cast<Value*>(&args_[-2])); 4301 return Local<Value>(reinterpret_cast<Value*>(&args_[-2]));
4288 } 4302 }
4289 4303
4290 4304
4291 Local<Object> AccessorInfo::This() const { 4305 Local<Object> AccessorInfo::This() const {
4292 return Local<Object>(reinterpret_cast<Object*>(&args_[0])); 4306 return Local<Object>(reinterpret_cast<Object*>(&args_[0]));
4293 } 4307 }
4294 4308
4295 4309
(...skipping 15 matching lines...) Expand all
4311 4325
4312 4326
4313 } // namespace v8 4327 } // namespace v8
4314 4328
4315 4329
4316 #undef V8EXPORT 4330 #undef V8EXPORT
4317 #undef TYPE_CHECK 4331 #undef TYPE_CHECK
4318 4332
4319 4333
4320 #endif // V8_H_ 4334 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/apiutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698