Rename Proxy class to Foreign, to avoid confusion with Harmony proxies.
Also fix grokdump, which was off by one after intro of JSProxy type. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7959 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
eea59292e6
commit
abd77ad439
@ -3698,14 +3698,14 @@ class Internals {
|
||||
static const int kStringResourceOffset =
|
||||
InternalConstants<kApiPointerSize>::kStringResourceOffset;
|
||||
|
||||
static const int kProxyProxyOffset = kApiPointerSize;
|
||||
static const int kForeignAddressOffset = kApiPointerSize;
|
||||
static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
|
||||
static const int kFullStringRepresentationMask = 0x07;
|
||||
static const int kExternalTwoByteRepresentationTag = 0x02;
|
||||
|
||||
static const int kJSObjectType = 0xa2;
|
||||
static const int kFirstNonstringType = 0x80;
|
||||
static const int kProxyType = 0x85;
|
||||
static const int kForeignType = 0x85;
|
||||
|
||||
static inline bool HasHeapObjectTag(internal::Object* value) {
|
||||
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
|
||||
@ -3734,8 +3734,8 @@ class Internals {
|
||||
static inline void* GetExternalPointer(internal::Object* obj) {
|
||||
if (HasSmiTag(obj)) {
|
||||
return GetExternalPointerFromSmi(obj);
|
||||
} else if (GetInstanceType(obj) == kProxyType) {
|
||||
return ReadField<void*>(obj, kProxyProxyOffset);
|
||||
} else if (GetInstanceType(obj) == kForeignType) {
|
||||
return ReadField<void*>(obj, kForeignAddressOffset);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
48
src/api.cc
48
src/api.cc
@ -936,9 +936,9 @@ int TypeSwitch::match(v8::Handle<Value> value) {
|
||||
}
|
||||
|
||||
|
||||
#define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
|
||||
i::Handle<i::Object> proxy = FromCData(cdata); \
|
||||
(obj)->setter(*proxy); \
|
||||
#define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
|
||||
i::Handle<i::Object> foreign = FromCData(cdata); \
|
||||
(obj)->setter(*foreign); \
|
||||
} while (false)
|
||||
|
||||
|
||||
@ -2058,7 +2058,7 @@ bool Value::IsExternal() const {
|
||||
if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsExternal()")) {
|
||||
return false;
|
||||
}
|
||||
return Utils::OpenHandle(this)->IsProxy();
|
||||
return Utils::OpenHandle(this)->IsForeign();
|
||||
}
|
||||
|
||||
|
||||
@ -2219,7 +2219,7 @@ Local<Integer> Value::ToInteger() const {
|
||||
void External::CheckCast(v8::Value* that) {
|
||||
if (IsDeadCheck(i::Isolate::Current(), "v8::External::Cast()")) return;
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(that);
|
||||
ApiCheck(obj->IsProxy(),
|
||||
ApiCheck(obj->IsForeign(),
|
||||
"v8::External::Cast()",
|
||||
"Could not convert to external");
|
||||
}
|
||||
@ -3729,11 +3729,11 @@ void v8::Object::SetPointerInInternalField(int index, void* value) {
|
||||
Utils::OpenHandle(this)->SetInternalField(index, EncodeAsSmi(value));
|
||||
} else {
|
||||
HandleScope scope;
|
||||
i::Handle<i::Proxy> proxy =
|
||||
isolate->factory()->NewProxy(
|
||||
i::Handle<i::Foreign> foreign =
|
||||
isolate->factory()->NewForeign(
|
||||
reinterpret_cast<i::Address>(value), i::TENURED);
|
||||
if (!proxy.is_null())
|
||||
Utils::OpenHandle(this)->SetInternalField(index, *proxy);
|
||||
if (!foreign.is_null())
|
||||
Utils::OpenHandle(this)->SetInternalField(index, *foreign);
|
||||
}
|
||||
ASSERT_EQ(value, GetPointerFromInternalField(index));
|
||||
}
|
||||
@ -4069,11 +4069,11 @@ bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) {
|
||||
|
||||
|
||||
static Local<External> ExternalNewImpl(void* data) {
|
||||
return Utils::ToLocal(FACTORY->NewProxy(static_cast<i::Address>(data)));
|
||||
return Utils::ToLocal(FACTORY->NewForeign(static_cast<i::Address>(data)));
|
||||
}
|
||||
|
||||
static void* ExternalValueImpl(i::Handle<i::Object> obj) {
|
||||
return reinterpret_cast<void*>(i::Proxy::cast(*obj)->proxy());
|
||||
return reinterpret_cast<void*>(i::Foreign::cast(*obj)->address());
|
||||
}
|
||||
|
||||
|
||||
@ -4098,8 +4098,8 @@ void* v8::Object::SlowGetPointerFromInternalField(int index) {
|
||||
i::Object* value = obj->GetInternalField(index);
|
||||
if (value->IsSmi()) {
|
||||
return i::Internals::GetExternalPointerFromSmi(value);
|
||||
} else if (value->IsProxy()) {
|
||||
return reinterpret_cast<void*>(i::Proxy::cast(value)->proxy());
|
||||
} else if (value->IsForeign()) {
|
||||
return reinterpret_cast<void*>(i::Foreign::cast(value)->address());
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@ -4112,7 +4112,7 @@ void* v8::External::FullUnwrap(v8::Handle<v8::Value> wrapper) {
|
||||
void* result;
|
||||
if (obj->IsSmi()) {
|
||||
result = i::Internals::GetExternalPointerFromSmi(*obj);
|
||||
} else if (obj->IsProxy()) {
|
||||
} else if (obj->IsForeign()) {
|
||||
result = ExternalValueImpl(obj);
|
||||
} else {
|
||||
result = NULL;
|
||||
@ -4558,7 +4558,7 @@ bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
|
||||
i::HandleScope scope(isolate);
|
||||
NeanderArray listeners(isolate->factory()->message_listeners());
|
||||
NeanderObject obj(2);
|
||||
obj.set(0, *isolate->factory()->NewProxy(FUNCTION_ADDR(that)));
|
||||
obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that)));
|
||||
obj.set(1, data.IsEmpty() ?
|
||||
isolate->heap()->undefined_value() :
|
||||
*Utils::OpenHandle(*data));
|
||||
@ -4578,8 +4578,8 @@ void V8::RemoveMessageListeners(MessageCallback that) {
|
||||
if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones
|
||||
|
||||
NeanderObject listener(i::JSObject::cast(listeners.get(i)));
|
||||
i::Handle<i::Proxy> callback_obj(i::Proxy::cast(listener.get(0)));
|
||||
if (callback_obj->proxy() == FUNCTION_ADDR(that)) {
|
||||
i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listener.get(0)));
|
||||
if (callback_obj->address() == FUNCTION_ADDR(that)) {
|
||||
listeners.set(i, isolate->heap()->undefined_value());
|
||||
}
|
||||
}
|
||||
@ -5049,11 +5049,12 @@ bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) {
|
||||
isolate->set_debug_event_callback(that);
|
||||
|
||||
i::HandleScope scope(isolate);
|
||||
i::Handle<i::Object> proxy = isolate->factory()->undefined_value();
|
||||
i::Handle<i::Object> foreign = isolate->factory()->undefined_value();
|
||||
if (that != NULL) {
|
||||
proxy = isolate->factory()->NewProxy(FUNCTION_ADDR(EventCallbackWrapper));
|
||||
foreign =
|
||||
isolate->factory()->NewForeign(FUNCTION_ADDR(EventCallbackWrapper));
|
||||
}
|
||||
isolate->debugger()->SetEventListener(proxy, Utils::OpenHandle(*data));
|
||||
isolate->debugger()->SetEventListener(foreign, Utils::OpenHandle(*data));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -5064,12 +5065,11 @@ bool Debug::SetDebugEventListener2(EventCallback2 that, Handle<Value> data) {
|
||||
ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener2()", return false);
|
||||
ENTER_V8(isolate);
|
||||
i::HandleScope scope(isolate);
|
||||
i::Handle<i::Object> proxy = isolate->factory()->undefined_value();
|
||||
i::Handle<i::Object> foreign = isolate->factory()->undefined_value();
|
||||
if (that != NULL) {
|
||||
proxy = isolate->factory()->NewProxy(FUNCTION_ADDR(that));
|
||||
foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that));
|
||||
}
|
||||
isolate->debugger()->SetEventListener(proxy,
|
||||
Utils::OpenHandle(*data));
|
||||
isolate->debugger()->SetEventListener(foreign, Utils::OpenHandle(*data));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
12
src/api.h
12
src/api.h
@ -115,14 +115,14 @@ void NeanderObject::set(int offset, v8::internal::Object* value) {
|
||||
template <typename T> static inline T ToCData(v8::internal::Object* obj) {
|
||||
STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
|
||||
return reinterpret_cast<T>(
|
||||
reinterpret_cast<intptr_t>(v8::internal::Proxy::cast(obj)->proxy()));
|
||||
reinterpret_cast<intptr_t>(v8::internal::Foreign::cast(obj)->address()));
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
static inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) {
|
||||
STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
|
||||
return FACTORY->NewProxy(
|
||||
return FACTORY->NewForeign(
|
||||
reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj)));
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ class Utils {
|
||||
static inline Local<Array> ToLocal(
|
||||
v8::internal::Handle<v8::internal::JSArray> obj);
|
||||
static inline Local<External> ToLocal(
|
||||
v8::internal::Handle<v8::internal::Proxy> obj);
|
||||
v8::internal::Handle<v8::internal::Foreign> obj);
|
||||
static inline Local<Message> MessageToLocal(
|
||||
v8::internal::Handle<v8::internal::Object> obj);
|
||||
static inline Local<StackTrace> StackTraceToLocal(
|
||||
@ -236,7 +236,7 @@ class Utils {
|
||||
OpenHandle(const v8::Signature* sig);
|
||||
static inline v8::internal::Handle<v8::internal::TypeSwitchInfo>
|
||||
OpenHandle(const v8::TypeSwitch* that);
|
||||
static inline v8::internal::Handle<v8::internal::Proxy>
|
||||
static inline v8::internal::Handle<v8::internal::Foreign>
|
||||
OpenHandle(const v8::External* that);
|
||||
};
|
||||
|
||||
@ -273,7 +273,7 @@ MAKE_TO_LOCAL(ToLocal, String, String)
|
||||
MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp)
|
||||
MAKE_TO_LOCAL(ToLocal, JSObject, Object)
|
||||
MAKE_TO_LOCAL(ToLocal, JSArray, Array)
|
||||
MAKE_TO_LOCAL(ToLocal, Proxy, External)
|
||||
MAKE_TO_LOCAL(ToLocal, Foreign, External)
|
||||
MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate)
|
||||
MAKE_TO_LOCAL(ToLocal, ObjectTemplateInfo, ObjectTemplate)
|
||||
MAKE_TO_LOCAL(ToLocal, SignatureInfo, Signature)
|
||||
@ -311,7 +311,7 @@ MAKE_OPEN_HANDLE(Script, Object)
|
||||
MAKE_OPEN_HANDLE(Function, JSFunction)
|
||||
MAKE_OPEN_HANDLE(Message, JSObject)
|
||||
MAKE_OPEN_HANDLE(Context, Context)
|
||||
MAKE_OPEN_HANDLE(External, Proxy)
|
||||
MAKE_OPEN_HANDLE(External, Foreign)
|
||||
MAKE_OPEN_HANDLE(StackTrace, JSArray)
|
||||
MAKE_OPEN_HANDLE(StackFrame, JSObject)
|
||||
|
||||
|
@ -363,23 +363,24 @@ Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor(
|
||||
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
|
||||
|
||||
{ // Add length.
|
||||
Handle<Proxy> proxy = factory()->NewProxy(&Accessors::FunctionLength);
|
||||
CallbacksDescriptor d(*factory()->length_symbol(), *proxy, attributes);
|
||||
Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength);
|
||||
CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes);
|
||||
descriptors->Set(0, &d);
|
||||
}
|
||||
{ // Add name.
|
||||
Handle<Proxy> proxy = factory()->NewProxy(&Accessors::FunctionName);
|
||||
CallbacksDescriptor d(*factory()->name_symbol(), *proxy, attributes);
|
||||
Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName);
|
||||
CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes);
|
||||
descriptors->Set(1, &d);
|
||||
}
|
||||
{ // Add arguments.
|
||||
Handle<Proxy> proxy = factory()->NewProxy(&Accessors::FunctionArguments);
|
||||
CallbacksDescriptor d(*factory()->arguments_symbol(), *proxy, attributes);
|
||||
Handle<Foreign> foreign =
|
||||
factory()->NewForeign(&Accessors::FunctionArguments);
|
||||
CallbacksDescriptor d(*factory()->arguments_symbol(), *foreign, attributes);
|
||||
descriptors->Set(2, &d);
|
||||
}
|
||||
{ // Add caller.
|
||||
Handle<Proxy> proxy = factory()->NewProxy(&Accessors::FunctionCaller);
|
||||
CallbacksDescriptor d(*factory()->caller_symbol(), *proxy, attributes);
|
||||
Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionCaller);
|
||||
CallbacksDescriptor d(*factory()->caller_symbol(), *foreign, attributes);
|
||||
descriptors->Set(3, &d);
|
||||
}
|
||||
if (prototypeMode != DONT_ADD_PROTOTYPE) {
|
||||
@ -387,8 +388,9 @@ Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor(
|
||||
if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
|
||||
attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY);
|
||||
}
|
||||
Handle<Proxy> proxy = factory()->NewProxy(&Accessors::FunctionPrototype);
|
||||
CallbacksDescriptor d(*factory()->prototype_symbol(), *proxy, attributes);
|
||||
Handle<Foreign> foreign =
|
||||
factory()->NewForeign(&Accessors::FunctionPrototype);
|
||||
CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes);
|
||||
descriptors->Set(4, &d);
|
||||
}
|
||||
descriptors->Sort();
|
||||
@ -510,13 +512,13 @@ Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor(
|
||||
DONT_ENUM | DONT_DELETE | READ_ONLY);
|
||||
|
||||
{ // length
|
||||
Handle<Proxy> proxy = factory()->NewProxy(&Accessors::FunctionLength);
|
||||
CallbacksDescriptor d(*factory()->length_symbol(), *proxy, attributes);
|
||||
Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength);
|
||||
CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes);
|
||||
descriptors->Set(0, &d);
|
||||
}
|
||||
{ // name
|
||||
Handle<Proxy> proxy = factory()->NewProxy(&Accessors::FunctionName);
|
||||
CallbacksDescriptor d(*factory()->name_symbol(), *proxy, attributes);
|
||||
Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName);
|
||||
CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes);
|
||||
descriptors->Set(1, &d);
|
||||
}
|
||||
{ // arguments
|
||||
@ -535,8 +537,9 @@ Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor(
|
||||
if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
|
||||
attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY);
|
||||
}
|
||||
Handle<Proxy> proxy = factory()->NewProxy(&Accessors::FunctionPrototype);
|
||||
CallbacksDescriptor d(*factory()->prototype_symbol(), *proxy, attributes);
|
||||
Handle<Foreign> foreign =
|
||||
factory()->NewForeign(&Accessors::FunctionPrototype);
|
||||
CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes);
|
||||
descriptors->Set(4, &d);
|
||||
}
|
||||
|
||||
@ -847,10 +850,10 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
||||
// is 1.
|
||||
array_function->shared()->set_length(1);
|
||||
Handle<DescriptorArray> array_descriptors =
|
||||
factory->CopyAppendProxyDescriptor(
|
||||
factory->CopyAppendForeignDescriptor(
|
||||
factory->empty_descriptor_array(),
|
||||
factory->length_symbol(),
|
||||
factory->NewProxy(&Accessors::ArrayLength),
|
||||
factory->NewForeign(&Accessors::ArrayLength),
|
||||
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE));
|
||||
|
||||
// Cache the fast JavaScript array map
|
||||
@ -890,10 +893,10 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
||||
global_context()->set_string_function(*string_fun);
|
||||
// Add 'length' property to strings.
|
||||
Handle<DescriptorArray> string_descriptors =
|
||||
factory->CopyAppendProxyDescriptor(
|
||||
factory->CopyAppendForeignDescriptor(
|
||||
factory->empty_descriptor_array(),
|
||||
factory->length_symbol(),
|
||||
factory->NewProxy(&Accessors::StringLength),
|
||||
factory->NewForeign(&Accessors::StringLength),
|
||||
static_cast<PropertyAttributes>(DONT_ENUM |
|
||||
DONT_DELETE |
|
||||
READ_ONLY));
|
||||
@ -1358,104 +1361,108 @@ bool Genesis::InstallNatives() {
|
||||
// Add 'source' and 'data' property to scripts.
|
||||
PropertyAttributes common_attributes =
|
||||
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
|
||||
Handle<Proxy> proxy_source = factory()->NewProxy(&Accessors::ScriptSource);
|
||||
Handle<Foreign> foreign_source =
|
||||
factory()->NewForeign(&Accessors::ScriptSource);
|
||||
Handle<DescriptorArray> script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
factory()->empty_descriptor_array(),
|
||||
factory()->LookupAsciiSymbol("source"),
|
||||
proxy_source,
|
||||
foreign_source,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_name = factory()->NewProxy(&Accessors::ScriptName);
|
||||
Handle<Foreign> foreign_name =
|
||||
factory()->NewForeign(&Accessors::ScriptName);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("name"),
|
||||
proxy_name,
|
||||
foreign_name,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_id = factory()->NewProxy(&Accessors::ScriptId);
|
||||
Handle<Foreign> foreign_id = factory()->NewForeign(&Accessors::ScriptId);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("id"),
|
||||
proxy_id,
|
||||
foreign_id,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_line_offset =
|
||||
factory()->NewProxy(&Accessors::ScriptLineOffset);
|
||||
Handle<Foreign> foreign_line_offset =
|
||||
factory()->NewForeign(&Accessors::ScriptLineOffset);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("line_offset"),
|
||||
proxy_line_offset,
|
||||
foreign_line_offset,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_column_offset =
|
||||
factory()->NewProxy(&Accessors::ScriptColumnOffset);
|
||||
Handle<Foreign> foreign_column_offset =
|
||||
factory()->NewForeign(&Accessors::ScriptColumnOffset);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("column_offset"),
|
||||
proxy_column_offset,
|
||||
foreign_column_offset,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_data = factory()->NewProxy(&Accessors::ScriptData);
|
||||
Handle<Foreign> foreign_data =
|
||||
factory()->NewForeign(&Accessors::ScriptData);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("data"),
|
||||
proxy_data,
|
||||
foreign_data,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_type = factory()->NewProxy(&Accessors::ScriptType);
|
||||
Handle<Foreign> foreign_type =
|
||||
factory()->NewForeign(&Accessors::ScriptType);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("type"),
|
||||
proxy_type,
|
||||
foreign_type,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_compilation_type =
|
||||
factory()->NewProxy(&Accessors::ScriptCompilationType);
|
||||
Handle<Foreign> foreign_compilation_type =
|
||||
factory()->NewForeign(&Accessors::ScriptCompilationType);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("compilation_type"),
|
||||
proxy_compilation_type,
|
||||
foreign_compilation_type,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_line_ends =
|
||||
factory()->NewProxy(&Accessors::ScriptLineEnds);
|
||||
Handle<Foreign> foreign_line_ends =
|
||||
factory()->NewForeign(&Accessors::ScriptLineEnds);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("line_ends"),
|
||||
proxy_line_ends,
|
||||
foreign_line_ends,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_context_data =
|
||||
factory()->NewProxy(&Accessors::ScriptContextData);
|
||||
Handle<Foreign> foreign_context_data =
|
||||
factory()->NewForeign(&Accessors::ScriptContextData);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("context_data"),
|
||||
proxy_context_data,
|
||||
foreign_context_data,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_eval_from_script =
|
||||
factory()->NewProxy(&Accessors::ScriptEvalFromScript);
|
||||
Handle<Foreign> foreign_eval_from_script =
|
||||
factory()->NewForeign(&Accessors::ScriptEvalFromScript);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("eval_from_script"),
|
||||
proxy_eval_from_script,
|
||||
foreign_eval_from_script,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_eval_from_script_position =
|
||||
factory()->NewProxy(&Accessors::ScriptEvalFromScriptPosition);
|
||||
Handle<Foreign> foreign_eval_from_script_position =
|
||||
factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("eval_from_script_position"),
|
||||
proxy_eval_from_script_position,
|
||||
foreign_eval_from_script_position,
|
||||
common_attributes);
|
||||
Handle<Proxy> proxy_eval_from_function_name =
|
||||
factory()->NewProxy(&Accessors::ScriptEvalFromFunctionName);
|
||||
Handle<Foreign> foreign_eval_from_function_name =
|
||||
factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName);
|
||||
script_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
script_descriptors,
|
||||
factory()->LookupAsciiSymbol("eval_from_function_name"),
|
||||
proxy_eval_from_function_name,
|
||||
foreign_eval_from_function_name,
|
||||
common_attributes);
|
||||
|
||||
Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
|
||||
@ -1508,10 +1515,10 @@ bool Genesis::InstallNatives() {
|
||||
|
||||
// Make "length" magic on instances.
|
||||
Handle<DescriptorArray> array_descriptors =
|
||||
factory()->CopyAppendProxyDescriptor(
|
||||
factory()->CopyAppendForeignDescriptor(
|
||||
factory()->empty_descriptor_array(),
|
||||
factory()->length_symbol(),
|
||||
factory()->NewProxy(&Accessors::ArrayLength),
|
||||
factory()->NewForeign(&Accessors::ArrayLength),
|
||||
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE));
|
||||
|
||||
array_function->initial_map()->set_instance_descriptors(
|
||||
|
@ -2365,7 +2365,7 @@ void Debugger::CallEventCallback(v8::DebugEvent event,
|
||||
Handle<Object> exec_state,
|
||||
Handle<Object> event_data,
|
||||
v8::Debug::ClientData* client_data) {
|
||||
if (event_listener_->IsProxy()) {
|
||||
if (event_listener_->IsForeign()) {
|
||||
CallCEventCallback(event, exec_state, event_data, client_data);
|
||||
} else {
|
||||
CallJSEventCallback(event, exec_state, event_data);
|
||||
@ -2377,9 +2377,9 @@ void Debugger::CallCEventCallback(v8::DebugEvent event,
|
||||
Handle<Object> exec_state,
|
||||
Handle<Object> event_data,
|
||||
v8::Debug::ClientData* client_data) {
|
||||
Handle<Proxy> callback_obj(Handle<Proxy>::cast(event_listener_));
|
||||
Handle<Foreign> callback_obj(Handle<Foreign>::cast(event_listener_));
|
||||
v8::Debug::EventCallback2 callback =
|
||||
FUNCTION_CAST<v8::Debug::EventCallback2>(callback_obj->proxy());
|
||||
FUNCTION_CAST<v8::Debug::EventCallback2>(callback_obj->address());
|
||||
EventDetailsImpl event_details(
|
||||
event,
|
||||
Handle<JSObject>::cast(exec_state),
|
||||
|
@ -266,7 +266,7 @@ Handle<Script> Factory::NewScript(Handle<String> source) {
|
||||
heap->SetLastScriptId(Smi::FromInt(id));
|
||||
|
||||
// Create and initialize script object.
|
||||
Handle<Proxy> wrapper = NewProxy(0, TENURED);
|
||||
Handle<Foreign> wrapper = NewForeign(0, TENURED);
|
||||
Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE));
|
||||
script->set_source(*source);
|
||||
script->set_name(heap->undefined_value());
|
||||
@ -286,15 +286,15 @@ Handle<Script> Factory::NewScript(Handle<String> source) {
|
||||
}
|
||||
|
||||
|
||||
Handle<Proxy> Factory::NewProxy(Address addr, PretenureFlag pretenure) {
|
||||
Handle<Foreign> Factory::NewForeign(Address addr, PretenureFlag pretenure) {
|
||||
CALL_HEAP_FUNCTION(isolate(),
|
||||
isolate()->heap()->AllocateProxy(addr, pretenure),
|
||||
Proxy);
|
||||
isolate()->heap()->AllocateForeign(addr, pretenure),
|
||||
Foreign);
|
||||
}
|
||||
|
||||
|
||||
Handle<Proxy> Factory::NewProxy(const AccessorDescriptor* desc) {
|
||||
return NewProxy((Address) desc, TENURED);
|
||||
Handle<Foreign> Factory::NewForeign(const AccessorDescriptor* desc) {
|
||||
return NewForeign((Address) desc, TENURED);
|
||||
}
|
||||
|
||||
|
||||
@ -712,7 +712,7 @@ MUST_USE_RESULT static inline MaybeObject* DoCopyInsert(
|
||||
|
||||
|
||||
// Allocate the new array.
|
||||
Handle<DescriptorArray> Factory::CopyAppendProxyDescriptor(
|
||||
Handle<DescriptorArray> Factory::CopyAppendForeignDescriptor(
|
||||
Handle<DescriptorArray> array,
|
||||
Handle<String> key,
|
||||
Handle<Object> value,
|
||||
|
@ -156,13 +156,13 @@ class Factory {
|
||||
|
||||
Handle<Script> NewScript(Handle<String> source);
|
||||
|
||||
// Proxies are pretenured when allocated by the bootstrapper.
|
||||
Handle<Proxy> NewProxy(Address addr,
|
||||
PretenureFlag pretenure = NOT_TENURED);
|
||||
// Foreign objects are pretenured when allocated by the bootstrapper.
|
||||
Handle<Foreign> NewForeign(Address addr,
|
||||
PretenureFlag pretenure = NOT_TENURED);
|
||||
|
||||
// Allocate a new proxy. The proxy is pretenured (allocated directly in
|
||||
// the old generation).
|
||||
Handle<Proxy> NewProxy(const AccessorDescriptor* proxy);
|
||||
// Allocate a new foreign object. The foreign is pretenured (allocated
|
||||
// directly in the old generation).
|
||||
Handle<Foreign> NewForeign(const AccessorDescriptor* foreign);
|
||||
|
||||
Handle<ByteArray> NewByteArray(int length,
|
||||
PretenureFlag pretenure = NOT_TENURED);
|
||||
@ -316,7 +316,7 @@ class Factory {
|
||||
Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name,
|
||||
Handle<Code> code);
|
||||
|
||||
Handle<DescriptorArray> CopyAppendProxyDescriptor(
|
||||
Handle<DescriptorArray> CopyAppendForeignDescriptor(
|
||||
Handle<DescriptorArray> array,
|
||||
Handle<String> key,
|
||||
Handle<Object> value,
|
||||
|
@ -544,7 +544,7 @@ Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info) {
|
||||
|
||||
|
||||
// Wrappers for scripts are kept alive and cached in weak global
|
||||
// handles referred from proxy objects held by the scripts as long as
|
||||
// handles referred from foreign objects held by the scripts as long as
|
||||
// they are used. When they are not used anymore, the garbage
|
||||
// collector will call the weak callback on the global handle
|
||||
// associated with the wrapper and get rid of both the wrapper and the
|
||||
@ -557,9 +557,9 @@ static void ClearWrapperCache(Persistent<v8::Value> handle, void*) {
|
||||
#endif
|
||||
Handle<Object> cache = Utils::OpenHandle(*handle);
|
||||
JSValue* wrapper = JSValue::cast(*cache);
|
||||
Proxy* proxy = Script::cast(wrapper->value())->wrapper();
|
||||
ASSERT(proxy->proxy() == reinterpret_cast<Address>(cache.location()));
|
||||
proxy->set_proxy(0);
|
||||
Foreign* foreign = Script::cast(wrapper->value())->wrapper();
|
||||
ASSERT(foreign->address() == reinterpret_cast<Address>(cache.location()));
|
||||
foreign->set_address(0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
isolate->global_handles()->Destroy(cache.location());
|
||||
isolate->counters()->script_wrappers()->Decrement();
|
||||
@ -567,10 +567,10 @@ static void ClearWrapperCache(Persistent<v8::Value> handle, void*) {
|
||||
|
||||
|
||||
Handle<JSValue> GetScriptWrapper(Handle<Script> script) {
|
||||
if (script->wrapper()->proxy() != NULL) {
|
||||
if (script->wrapper()->address() != NULL) {
|
||||
// Return the script wrapper directly from the cache.
|
||||
return Handle<JSValue>(
|
||||
reinterpret_cast<JSValue**>(script->wrapper()->proxy()));
|
||||
reinterpret_cast<JSValue**>(script->wrapper()->address()));
|
||||
}
|
||||
Isolate* isolate = Isolate::Current();
|
||||
// Construct a new script wrapper.
|
||||
@ -586,7 +586,7 @@ Handle<JSValue> GetScriptWrapper(Handle<Script> script) {
|
||||
Handle<Object> handle = isolate->global_handles()->Create(*result);
|
||||
isolate->global_handles()->MakeWeak(handle.location(), NULL,
|
||||
&ClearWrapperCache);
|
||||
script->wrapper()->set_proxy(reinterpret_cast<Address>(handle.location()));
|
||||
script->wrapper()->set_address(reinterpret_cast<Address>(handle.location()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
20
src/heap.cc
20
src/heap.cc
@ -1730,10 +1730,10 @@ bool Heap::CreateInitialMaps() {
|
||||
}
|
||||
set_heap_number_map(Map::cast(obj));
|
||||
|
||||
{ MaybeObject* maybe_obj = AllocateMap(PROXY_TYPE, Proxy::kSize);
|
||||
{ MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize);
|
||||
if (!maybe_obj->ToObject(&obj)) return false;
|
||||
}
|
||||
set_proxy_map(Map::cast(obj));
|
||||
set_foreign_map(Map::cast(obj));
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(string_type_table); i++) {
|
||||
const StringTypeTable& entry = string_type_table[i];
|
||||
@ -2118,12 +2118,12 @@ bool Heap::CreateInitialObjects() {
|
||||
}
|
||||
hidden_symbol_ = String::cast(obj);
|
||||
|
||||
// Allocate the proxy for __proto__.
|
||||
// Allocate the foreign for __proto__.
|
||||
{ MaybeObject* maybe_obj =
|
||||
AllocateProxy((Address) &Accessors::ObjectPrototype);
|
||||
AllocateForeign((Address) &Accessors::ObjectPrototype);
|
||||
if (!maybe_obj->ToObject(&obj)) return false;
|
||||
}
|
||||
set_prototype_accessors(Proxy::cast(obj));
|
||||
set_prototype_accessors(Foreign::cast(obj));
|
||||
|
||||
// Allocate the code_stubs dictionary. The initial size is set to avoid
|
||||
// expanding the dictionary during bootstrapping.
|
||||
@ -2341,16 +2341,16 @@ MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* Heap::AllocateProxy(Address proxy, PretenureFlag pretenure) {
|
||||
// Statically ensure that it is safe to allocate proxies in paged spaces.
|
||||
STATIC_ASSERT(Proxy::kSize <= Page::kMaxHeapObjectSize);
|
||||
MaybeObject* Heap::AllocateForeign(Address address, PretenureFlag pretenure) {
|
||||
// Statically ensure that it is safe to allocate foreigns in paged spaces.
|
||||
STATIC_ASSERT(Foreign::kSize <= Page::kMaxHeapObjectSize);
|
||||
AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
|
||||
Object* result;
|
||||
{ MaybeObject* maybe_result = Allocate(proxy_map(), space);
|
||||
{ MaybeObject* maybe_result = Allocate(foreign_map(), space);
|
||||
if (!maybe_result->ToObject(&result)) return maybe_result;
|
||||
}
|
||||
|
||||
Proxy::cast(result)->set_proxy(proxy);
|
||||
Foreign::cast(result)->set_address(address);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
10
src/heap.h
10
src/heap.h
@ -112,12 +112,12 @@ inline Heap* _inline_get_heap_();
|
||||
V(Map, global_property_cell_map, GlobalPropertyCellMap) \
|
||||
V(Map, shared_function_info_map, SharedFunctionInfoMap) \
|
||||
V(Map, message_object_map, JSMessageObjectMap) \
|
||||
V(Map, proxy_map, ProxyMap) \
|
||||
V(Map, foreign_map, ForeignMap) \
|
||||
V(Object, nan_value, NanValue) \
|
||||
V(Object, minus_zero_value, MinusZeroValue) \
|
||||
V(Map, neander_map, NeanderMap) \
|
||||
V(JSObject, message_listeners, MessageListeners) \
|
||||
V(Proxy, prototype_accessors, PrototypeAccessors) \
|
||||
V(Foreign, prototype_accessors, PrototypeAccessors) \
|
||||
V(NumberDictionary, code_stubs, CodeStubs) \
|
||||
V(NumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \
|
||||
V(Code, js_entry_code, JsEntryCode) \
|
||||
@ -688,12 +688,12 @@ class Heap {
|
||||
// Please note this does not perform a garbage collection.
|
||||
MUST_USE_RESULT inline MaybeObject* NumberFromUint32(uint32_t value);
|
||||
|
||||
// Allocates a new proxy object.
|
||||
// Allocates a new foreign object.
|
||||
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
||||
// failed.
|
||||
// Please note this does not perform a garbage collection.
|
||||
MUST_USE_RESULT MaybeObject* AllocateProxy(
|
||||
Address proxy, PretenureFlag pretenure = NOT_TENURED);
|
||||
MUST_USE_RESULT MaybeObject* AllocateForeign(
|
||||
Address address, PretenureFlag pretenure = NOT_TENURED);
|
||||
|
||||
// Allocates a new SharedFunctionInfo object.
|
||||
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
||||
|
@ -118,7 +118,7 @@ typedef int (*RawComparer)(const void*, const void*);
|
||||
v(Code, "meta: Code") \
|
||||
v(Map, "meta: Map") \
|
||||
v(Oddball, "Oddball") \
|
||||
v(Proxy, "meta: Proxy") \
|
||||
v(Foreign, "meta: Foreign") \
|
||||
v(SharedFunctionInfo, "meta: SharedFunctionInfo") \
|
||||
v(Struct, "meta: Struct") \
|
||||
\
|
||||
|
@ -125,9 +125,9 @@ void MessageHandler::ReportMessage(Isolate* isolate,
|
||||
HandleScope scope;
|
||||
if (global_listeners.get(i)->IsUndefined()) continue;
|
||||
v8::NeanderObject listener(JSObject::cast(global_listeners.get(i)));
|
||||
Handle<Proxy> callback_obj(Proxy::cast(listener.get(0)));
|
||||
Handle<Foreign> callback_obj(Foreign::cast(listener.get(0)));
|
||||
v8::MessageCallback callback =
|
||||
FUNCTION_CAST<v8::MessageCallback>(callback_obj->proxy());
|
||||
FUNCTION_CAST<v8::MessageCallback>(callback_obj->address());
|
||||
Handle<Object> callback_data(listener.get(1));
|
||||
{
|
||||
// Do not allow exceptions to propagate.
|
||||
|
@ -158,8 +158,8 @@ void HeapObject::HeapObjectVerify() {
|
||||
case JS_PROXY_TYPE:
|
||||
JSProxy::cast(this)->JSProxyVerify();
|
||||
break;
|
||||
case PROXY_TYPE:
|
||||
Proxy::cast(this)->ProxyVerify();
|
||||
case FOREIGN_TYPE:
|
||||
Foreign::cast(this)->ForeignVerify();
|
||||
break;
|
||||
case SHARED_FUNCTION_INFO_TYPE:
|
||||
SharedFunctionInfo::cast(this)->SharedFunctionInfoVerify();
|
||||
@ -469,8 +469,8 @@ void JSProxy::JSProxyVerify() {
|
||||
VerifyPointer(handler());
|
||||
}
|
||||
|
||||
void Proxy::ProxyVerify() {
|
||||
ASSERT(IsProxy());
|
||||
void Foreign::ForeignVerify() {
|
||||
ASSERT(IsForeign());
|
||||
}
|
||||
|
||||
|
||||
|
@ -590,9 +590,9 @@ bool Object::IsJSProxy() {
|
||||
}
|
||||
|
||||
|
||||
bool Object::IsProxy() {
|
||||
bool Object::IsForeign() {
|
||||
return Object::IsHeapObject()
|
||||
&& HeapObject::cast(this)->map()->instance_type() == PROXY_TYPE;
|
||||
&& HeapObject::cast(this)->map()->instance_type() == FOREIGN_TYPE;
|
||||
}
|
||||
|
||||
|
||||
@ -1757,8 +1757,8 @@ Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
|
||||
|
||||
AccessorDescriptor* DescriptorArray::GetCallbacks(int descriptor_number) {
|
||||
ASSERT(GetType(descriptor_number) == CALLBACKS);
|
||||
Proxy* p = Proxy::cast(GetCallbacksObject(descriptor_number));
|
||||
return reinterpret_cast<AccessorDescriptor*>(p->proxy());
|
||||
Foreign* p = Foreign::cast(GetCallbacksObject(descriptor_number));
|
||||
return reinterpret_cast<AccessorDescriptor*>(p->address());
|
||||
}
|
||||
|
||||
|
||||
@ -1905,7 +1905,7 @@ CAST_ACCESSOR(Code)
|
||||
CAST_ACCESSOR(JSArray)
|
||||
CAST_ACCESSOR(JSRegExp)
|
||||
CAST_ACCESSOR(JSProxy)
|
||||
CAST_ACCESSOR(Proxy)
|
||||
CAST_ACCESSOR(Foreign)
|
||||
CAST_ACCESSOR(ByteArray)
|
||||
CAST_ACCESSOR(ExternalArray)
|
||||
CAST_ACCESSOR(ExternalByteArray)
|
||||
@ -3044,7 +3044,7 @@ ACCESSORS(Script, line_offset, Smi, kLineOffsetOffset)
|
||||
ACCESSORS(Script, column_offset, Smi, kColumnOffsetOffset)
|
||||
ACCESSORS(Script, data, Object, kDataOffset)
|
||||
ACCESSORS(Script, context_data, Object, kContextOffset)
|
||||
ACCESSORS(Script, wrapper, Proxy, kWrapperOffset)
|
||||
ACCESSORS(Script, wrapper, Foreign, kWrapperOffset)
|
||||
ACCESSORS(Script, type, Smi, kTypeOffset)
|
||||
ACCESSORS(Script, compilation_type, Smi, kCompilationTypeOffset)
|
||||
ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
|
||||
@ -3529,13 +3529,13 @@ void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id,
|
||||
ACCESSORS(JSProxy, handler, Object, kHandlerOffset)
|
||||
|
||||
|
||||
Address Proxy::proxy() {
|
||||
return AddressFrom<Address>(READ_INTPTR_FIELD(this, kProxyOffset));
|
||||
Address Foreign::address() {
|
||||
return AddressFrom<Address>(READ_INTPTR_FIELD(this, kAddressOffset));
|
||||
}
|
||||
|
||||
|
||||
void Proxy::set_proxy(Address value) {
|
||||
WRITE_INTPTR_FIELD(this, kProxyOffset, OffsetFrom(value));
|
||||
void Foreign::set_address(Address value) {
|
||||
WRITE_INTPTR_FIELD(this, kAddressOffset, OffsetFrom(value));
|
||||
}
|
||||
|
||||
|
||||
@ -4148,16 +4148,16 @@ int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) {
|
||||
}
|
||||
|
||||
|
||||
void Proxy::ProxyIterateBody(ObjectVisitor* v) {
|
||||
void Foreign::ForeignIterateBody(ObjectVisitor* v) {
|
||||
v->VisitExternalReference(
|
||||
reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset)));
|
||||
reinterpret_cast<Address *>(FIELD_ADDR(this, kAddressOffset)));
|
||||
}
|
||||
|
||||
|
||||
template<typename StaticVisitor>
|
||||
void Proxy::ProxyIterateBody() {
|
||||
void Foreign::ForeignIterateBody() {
|
||||
StaticVisitor::VisitExternalReference(
|
||||
reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset)));
|
||||
reinterpret_cast<Address *>(FIELD_ADDR(this, kAddressOffset)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,8 +151,8 @@ void HeapObject::HeapObjectPrint(FILE* out) {
|
||||
case JS_PROXY_TYPE:
|
||||
JSProxy::cast(this)->JSProxyPrint(out);
|
||||
break;
|
||||
case PROXY_TYPE:
|
||||
Proxy::cast(this)->ProxyPrint(out);
|
||||
case FOREIGN_TYPE:
|
||||
Foreign::cast(this)->ForeignPrint(out);
|
||||
break;
|
||||
case SHARED_FUNCTION_INFO_TYPE:
|
||||
SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out);
|
||||
@ -417,7 +417,7 @@ static const char* TypeToString(InstanceType type) {
|
||||
case JS_GLOBAL_OBJECT_TYPE: return "JS_GLOBAL_OBJECT";
|
||||
case JS_BUILTINS_OBJECT_TYPE: return "JS_BUILTINS_OBJECT";
|
||||
case JS_GLOBAL_PROXY_TYPE: return "JS_GLOBAL_PROXY";
|
||||
case PROXY_TYPE: return "PROXY";
|
||||
case FOREIGN_TYPE: return "FOREIGN";
|
||||
case JS_MESSAGE_OBJECT_TYPE: return "JS_MESSAGE_OBJECT_TYPE";
|
||||
#define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return #NAME;
|
||||
STRUCT_LIST(MAKE_STRUCT_CASE)
|
||||
@ -635,8 +635,8 @@ void Code::CodePrint(FILE* out) {
|
||||
}
|
||||
|
||||
|
||||
void Proxy::ProxyPrint(FILE* out) {
|
||||
PrintF(out, "proxy to %p", proxy());
|
||||
void Foreign::ForeignPrint(FILE* out) {
|
||||
PrintF(out, "foreign address : %p", address());
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,10 +93,10 @@ StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId(
|
||||
kVisitDataObjectGeneric,
|
||||
JSProxy::kSize);
|
||||
|
||||
case PROXY_TYPE:
|
||||
case FOREIGN_TYPE:
|
||||
return GetVisitorIdForSize(kVisitDataObject,
|
||||
kVisitDataObjectGeneric,
|
||||
Proxy::kSize);
|
||||
Foreign::kSize);
|
||||
|
||||
case FILLER_TYPE:
|
||||
return kVisitDataObjectGeneric;
|
||||
|
@ -174,11 +174,12 @@ MaybeObject* Object::GetPropertyWithCallback(Object* receiver,
|
||||
Object* holder) {
|
||||
Isolate* isolate = name->GetIsolate();
|
||||
// To accommodate both the old and the new api we switch on the
|
||||
// data structure used to store the callbacks. Eventually proxy
|
||||
// data structure used to store the callbacks. Eventually foreign
|
||||
// callbacks should be phased out.
|
||||
if (structure->IsProxy()) {
|
||||
if (structure->IsForeign()) {
|
||||
AccessorDescriptor* callback =
|
||||
reinterpret_cast<AccessorDescriptor*>(Proxy::cast(structure)->proxy());
|
||||
reinterpret_cast<AccessorDescriptor*>(
|
||||
Foreign::cast(structure)->address());
|
||||
MaybeObject* value = (callback->getter)(receiver, callback->data);
|
||||
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
|
||||
return value;
|
||||
@ -1126,8 +1127,8 @@ void HeapObject::HeapObjectShortPrint(StringStream* accumulator) {
|
||||
HeapNumber::cast(this)->HeapNumberPrint(accumulator);
|
||||
accumulator->Put('>');
|
||||
break;
|
||||
case PROXY_TYPE:
|
||||
accumulator->Add("<Proxy>");
|
||||
case FOREIGN_TYPE:
|
||||
accumulator->Add("<Foreign>");
|
||||
break;
|
||||
case JS_GLOBAL_PROPERTY_CELL_TYPE:
|
||||
accumulator->Add("Cell for ");
|
||||
@ -1198,8 +1199,8 @@ void HeapObject::IterateBody(InstanceType type, int object_size,
|
||||
case JS_PROXY_TYPE:
|
||||
JSProxy::BodyDescriptor::IterateBody(this, v);
|
||||
break;
|
||||
case PROXY_TYPE:
|
||||
reinterpret_cast<Proxy*>(this)->ProxyIterateBody(v);
|
||||
case FOREIGN_TYPE:
|
||||
reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v);
|
||||
break;
|
||||
case MAP_TYPE:
|
||||
Map::BodyDescriptor::IterateBody(this, v);
|
||||
@ -1780,11 +1781,12 @@ MaybeObject* JSObject::SetPropertyWithCallback(Object* structure,
|
||||
Handle<Object> value_handle(value, isolate);
|
||||
|
||||
// To accommodate both the old and the new api we switch on the
|
||||
// data structure used to store the callbacks. Eventually proxy
|
||||
// data structure used to store the callbacks. Eventually foreign
|
||||
// callbacks should be phased out.
|
||||
if (structure->IsProxy()) {
|
||||
if (structure->IsForeign()) {
|
||||
AccessorDescriptor* callback =
|
||||
reinterpret_cast<AccessorDescriptor*>(Proxy::cast(structure)->proxy());
|
||||
reinterpret_cast<AccessorDescriptor*>(
|
||||
Foreign::cast(structure)->address());
|
||||
MaybeObject* obj = (callback->setter)(this, value, callback->data);
|
||||
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
|
||||
if (obj->IsFailure()) return obj;
|
||||
@ -7325,7 +7327,7 @@ MaybeObject* JSObject::GetElementWithCallback(Object* receiver,
|
||||
uint32_t index,
|
||||
Object* holder) {
|
||||
Isolate* isolate = GetIsolate();
|
||||
ASSERT(!structure->IsProxy());
|
||||
ASSERT(!structure->IsForeign());
|
||||
|
||||
// api style callbacks.
|
||||
if (structure->IsAccessorInfo()) {
|
||||
@ -7380,9 +7382,9 @@ MaybeObject* JSObject::SetElementWithCallback(Object* structure,
|
||||
Handle<Object> value_handle(value, isolate);
|
||||
|
||||
// To accommodate both the old and the new api we switch on the
|
||||
// data structure used to store the callbacks. Eventually proxy
|
||||
// data structure used to store the callbacks. Eventually foreign
|
||||
// callbacks should be phased out.
|
||||
ASSERT(!structure->IsProxy());
|
||||
ASSERT(!structure->IsForeign());
|
||||
|
||||
if (structure->IsAccessorInfo()) {
|
||||
// api style callbacks
|
||||
|
@ -92,7 +92,7 @@
|
||||
// - Map
|
||||
// - Oddball
|
||||
// - JSProxy
|
||||
// - Proxy
|
||||
// - Foreign
|
||||
// - SharedFunctionInfo
|
||||
// - Struct
|
||||
// - AccessorInfo
|
||||
@ -290,7 +290,7 @@ static const int kVariableSizeSentinel = 0;
|
||||
\
|
||||
V(HEAP_NUMBER_TYPE) \
|
||||
V(JS_PROXY_TYPE) \
|
||||
V(PROXY_TYPE) \
|
||||
V(FOREIGN_TYPE) \
|
||||
V(BYTE_ARRAY_TYPE) \
|
||||
/* Note: the order of these external array */ \
|
||||
/* types is relied upon in */ \
|
||||
@ -517,7 +517,7 @@ enum InstanceType {
|
||||
// "Data", objects that cannot contain non-map-word pointers to heap
|
||||
// objects.
|
||||
HEAP_NUMBER_TYPE,
|
||||
PROXY_TYPE,
|
||||
FOREIGN_TYPE,
|
||||
JS_PROXY_TYPE,
|
||||
BYTE_ARRAY_TYPE,
|
||||
EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
|
||||
@ -591,7 +591,7 @@ static const int kExternalArrayTypeCount = LAST_EXTERNAL_ARRAY_TYPE -
|
||||
|
||||
STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType);
|
||||
STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
|
||||
STATIC_CHECK(PROXY_TYPE == Internals::kProxyType);
|
||||
STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType);
|
||||
|
||||
|
||||
enum CompareResult {
|
||||
@ -726,7 +726,7 @@ class MaybeObject BASE_EMBEDDED {
|
||||
V(JSValue) \
|
||||
V(JSMessageObject) \
|
||||
V(StringWrapper) \
|
||||
V(Proxy) \
|
||||
V(Foreign) \
|
||||
V(Boolean) \
|
||||
V(JSArray) \
|
||||
V(JSProxy) \
|
||||
@ -4009,7 +4009,7 @@ class Script: public Struct {
|
||||
DECL_ACCESSORS(context_data, Object)
|
||||
|
||||
// [wrapper]: the wrapper cache.
|
||||
DECL_ACCESSORS(wrapper, Proxy)
|
||||
DECL_ACCESSORS(wrapper, Foreign)
|
||||
|
||||
// [type]: the script type.
|
||||
DECL_ACCESSORS(type, Smi)
|
||||
@ -4749,7 +4749,7 @@ class JSFunction: public JSObject {
|
||||
|
||||
class JSGlobalProxy : public JSObject {
|
||||
public:
|
||||
// [context]: the owner global context of this proxy object.
|
||||
// [context]: the owner global context of this global proxy object.
|
||||
// It is null value if this object is not used by any context.
|
||||
DECL_ACCESSORS(context, Object)
|
||||
|
||||
@ -6142,43 +6142,43 @@ class JSProxy: public HeapObject {
|
||||
|
||||
|
||||
|
||||
// Proxy describes objects pointing from JavaScript to C structures.
|
||||
// Foreign describes objects pointing from JavaScript to C structures.
|
||||
// Since they cannot contain references to JS HeapObjects they can be
|
||||
// placed in old_data_space.
|
||||
class Proxy: public HeapObject {
|
||||
class Foreign: public HeapObject {
|
||||
public:
|
||||
// [proxy]: field containing the address.
|
||||
inline Address proxy();
|
||||
inline void set_proxy(Address value);
|
||||
// [address]: field containing the address.
|
||||
inline Address address();
|
||||
inline void set_address(Address value);
|
||||
|
||||
// Casting.
|
||||
static inline Proxy* cast(Object* obj);
|
||||
static inline Foreign* cast(Object* obj);
|
||||
|
||||
// Dispatched behavior.
|
||||
inline void ProxyIterateBody(ObjectVisitor* v);
|
||||
inline void ForeignIterateBody(ObjectVisitor* v);
|
||||
|
||||
template<typename StaticVisitor>
|
||||
inline void ProxyIterateBody();
|
||||
inline void ForeignIterateBody();
|
||||
|
||||
#ifdef OBJECT_PRINT
|
||||
inline void ProxyPrint() {
|
||||
ProxyPrint(stdout);
|
||||
inline void ForeignPrint() {
|
||||
ForeignPrint(stdout);
|
||||
}
|
||||
void ProxyPrint(FILE* out);
|
||||
void ForeignPrint(FILE* out);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void ProxyVerify();
|
||||
void ForeignVerify();
|
||||
#endif
|
||||
|
||||
// Layout description.
|
||||
|
||||
static const int kProxyOffset = HeapObject::kHeaderSize;
|
||||
static const int kSize = kProxyOffset + kPointerSize;
|
||||
static const int kAddressOffset = HeapObject::kHeaderSize;
|
||||
static const int kSize = kAddressOffset + kPointerSize;
|
||||
|
||||
STATIC_CHECK(kProxyOffset == Internals::kProxyProxyOffset);
|
||||
STATIC_CHECK(kAddressOffset == Internals::kForeignAddressOffset);
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Proxy);
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1736,7 +1736,7 @@ const char* V8HeapExplorer::GetSystemEntryName(HeapObject* object) {
|
||||
switch (object->map()->instance_type()) {
|
||||
case MAP_TYPE: return "system / Map";
|
||||
case JS_GLOBAL_PROPERTY_CELL_TYPE: return "system / JSGlobalPropertyCell";
|
||||
case PROXY_TYPE: return "system / Proxy";
|
||||
case FOREIGN_TYPE: return "system / Foreign";
|
||||
case ODDBALL_TYPE: return "system / Oddball";
|
||||
#define MAKE_STRUCT_CASE(NAME, Name, name) \
|
||||
case NAME##_TYPE: return "system / "#Name;
|
||||
|
@ -157,10 +157,10 @@ class ConstantFunctionDescriptor: public Descriptor {
|
||||
class CallbacksDescriptor: public Descriptor {
|
||||
public:
|
||||
CallbacksDescriptor(String* key,
|
||||
Object* proxy,
|
||||
Object* foreign,
|
||||
PropertyAttributes attributes,
|
||||
int index = 0)
|
||||
: Descriptor(key, proxy, attributes, CALLBACKS, index) {}
|
||||
: Descriptor(key, foreign, attributes, CALLBACKS, index) {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -9357,7 +9357,7 @@ static MaybeObject* DebugLookupResultValue(Heap* heap,
|
||||
return result->GetConstantFunction();
|
||||
case CALLBACKS: {
|
||||
Object* structure = result->GetCallbackObject();
|
||||
if (structure->IsProxy() || structure->IsAccessorInfo()) {
|
||||
if (structure->IsForeign() || structure->IsAccessorInfo()) {
|
||||
MaybeObject* maybe_value = receiver->GetPropertyWithCallback(
|
||||
receiver, structure, name, result->holder());
|
||||
if (!maybe_value->ToObject(&value)) {
|
||||
|
@ -154,7 +154,7 @@ class Object;
|
||||
class MaybeObject;
|
||||
class OldSpace;
|
||||
class Property;
|
||||
class Proxy;
|
||||
class Foreign;
|
||||
class RegExpNode;
|
||||
struct RegExpCompileData;
|
||||
class RegExpTree;
|
||||
|
@ -139,11 +139,11 @@ TEST(StressJS) {
|
||||
// Patch the map to have an accessor for "get".
|
||||
Handle<Map> map(function->initial_map());
|
||||
Handle<DescriptorArray> instance_descriptors(map->instance_descriptors());
|
||||
Handle<Proxy> proxy = FACTORY->NewProxy(&kDescriptor);
|
||||
instance_descriptors = FACTORY->CopyAppendProxyDescriptor(
|
||||
Handle<Foreign> foreign = FACTORY->NewForeign(&kDescriptor);
|
||||
instance_descriptors = FACTORY->CopyAppendForeignDescriptor(
|
||||
instance_descriptors,
|
||||
FACTORY->NewStringFromAscii(Vector<const char>("get", 3)),
|
||||
proxy,
|
||||
foreign,
|
||||
static_cast<PropertyAttributes>(0));
|
||||
map->set_instance_descriptors(*instance_descriptors);
|
||||
// Add the Foo constructor the global object.
|
||||
|
@ -393,41 +393,42 @@ INSTANCE_TYPES = {
|
||||
130: "ODDBALL_TYPE",
|
||||
131: "JS_GLOBAL_PROPERTY_CELL_TYPE",
|
||||
132: "HEAP_NUMBER_TYPE",
|
||||
133: "PROXY_TYPE",
|
||||
134: "BYTE_ARRAY_TYPE",
|
||||
135: "PIXEL_ARRAY_TYPE",
|
||||
136: "EXTERNAL_BYTE_ARRAY_TYPE",
|
||||
137: "EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE",
|
||||
138: "EXTERNAL_SHORT_ARRAY_TYPE",
|
||||
139: "EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE",
|
||||
140: "EXTERNAL_INT_ARRAY_TYPE",
|
||||
141: "EXTERNAL_UNSIGNED_INT_ARRAY_TYPE",
|
||||
142: "EXTERNAL_FLOAT_ARRAY_TYPE",
|
||||
143: "FILLER_TYPE",
|
||||
144: "ACCESSOR_INFO_TYPE",
|
||||
145: "ACCESS_CHECK_INFO_TYPE",
|
||||
146: "INTERCEPTOR_INFO_TYPE",
|
||||
147: "CALL_HANDLER_INFO_TYPE",
|
||||
148: "FUNCTION_TEMPLATE_INFO_TYPE",
|
||||
149: "OBJECT_TEMPLATE_INFO_TYPE",
|
||||
150: "SIGNATURE_INFO_TYPE",
|
||||
151: "TYPE_SWITCH_INFO_TYPE",
|
||||
152: "SCRIPT_TYPE",
|
||||
153: "CODE_CACHE_TYPE",
|
||||
156: "FIXED_ARRAY_TYPE",
|
||||
157: "SHARED_FUNCTION_INFO_TYPE",
|
||||
158: "JS_MESSAGE_OBJECT_TYPE",
|
||||
159: "JS_VALUE_TYPE",
|
||||
160: "JS_OBJECT_TYPE",
|
||||
161: "JS_CONTEXT_EXTENSION_OBJECT_TYPE",
|
||||
162: "JS_GLOBAL_OBJECT_TYPE",
|
||||
163: "JS_BUILTINS_OBJECT_TYPE",
|
||||
164: "JS_GLOBAL_PROXY_TYPE",
|
||||
165: "JS_ARRAY_TYPE",
|
||||
166: "JS_REGEXP_TYPE",
|
||||
167: "JS_FUNCTION_TYPE",
|
||||
154: "DEBUG_INFO_TYPE",
|
||||
155: "BREAK_POINT_INFO_TYPE",
|
||||
133: "JS_PROXY_TYPE",
|
||||
134: "FOREIGN_TYPE",
|
||||
135: "BYTE_ARRAY_TYPE",
|
||||
136: "PIXEL_ARRAY_TYPE",
|
||||
137: "EXTERNAL_BYTE_ARRAY_TYPE",
|
||||
138: "EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE",
|
||||
139: "EXTERNAL_SHORT_ARRAY_TYPE",
|
||||
140: "EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE",
|
||||
141: "EXTERNAL_INT_ARRAY_TYPE",
|
||||
142: "EXTERNAL_UNSIGNED_INT_ARRAY_TYPE",
|
||||
143: "EXTERNAL_FLOAT_ARRAY_TYPE",
|
||||
144: "FILLER_TYPE",
|
||||
145: "ACCESSOR_INFO_TYPE",
|
||||
146: "ACCESS_CHECK_INFO_TYPE",
|
||||
147: "INTERCEPTOR_INFO_TYPE",
|
||||
148: "CALL_HANDLER_INFO_TYPE",
|
||||
149: "FUNCTION_TEMPLATE_INFO_TYPE",
|
||||
150: "OBJECT_TEMPLATE_INFO_TYPE",
|
||||
151: "SIGNATURE_INFO_TYPE",
|
||||
152: "TYPE_SWITCH_INFO_TYPE",
|
||||
153: "SCRIPT_TYPE",
|
||||
154: "CODE_CACHE_TYPE",
|
||||
157: "FIXED_ARRAY_TYPE",
|
||||
158: "SHARED_FUNCTION_INFO_TYPE",
|
||||
159: "JS_MESSAGE_OBJECT_TYPE",
|
||||
160: "JS_VALUE_TYPE",
|
||||
161: "JS_OBJECT_TYPE",
|
||||
162: "JS_CONTEXT_EXTENSION_OBJECT_TYPE",
|
||||
163: "JS_GLOBAL_OBJECT_TYPE",
|
||||
164: "JS_BUILTINS_OBJECT_TYPE",
|
||||
165: "JS_GLOBAL_PROXY_TYPE",
|
||||
166: "JS_ARRAY_TYPE",
|
||||
167: "JS_REGEXP_TYPE",
|
||||
168: "JS_FUNCTION_TYPE",
|
||||
155: "DEBUG_INFO_TYPE",
|
||||
156: "BREAK_POINT_INFO_TYPE",
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user