OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "allocation-site-scopes.h" | 8 #include "allocation-site-scopes.h" |
9 #include "api.h" | 9 #include "api.h" |
10 #include "arguments.h" | 10 #include "arguments.h" |
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1950 if (object->map()->is_observed() && | 1950 if (object->map()->is_observed() && |
1951 *name != isolate->heap()->hidden_string()) { | 1951 *name != isolate->heap()->hidden_string()) { |
1952 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 1952 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
1953 EnqueueChangeRecord(object, "add", name, old_value); | 1953 EnqueueChangeRecord(object, "add", name, old_value); |
1954 } | 1954 } |
1955 | 1955 |
1956 return value; | 1956 return value; |
1957 } | 1957 } |
1958 | 1958 |
1959 | 1959 |
1960 Context* JSObject::GetCreationContext() { | |
1961 Object* constructor = this->map()->constructor(); | |
1962 JSFunction* function; | |
1963 if (!constructor->IsJSFunction()) { | |
1964 // Functions have null as a constructor, | |
1965 // but any JSFunction knows its context immediately. | |
1966 ASSERT(this->IsJSFunction()); | |
Toon Verwaest
2014/05/02 13:48:00
This assert is done already by JSFunction::cast so
| |
1967 function = JSFunction::cast(this); | |
1968 } else { | |
1969 function = JSFunction::cast(constructor); | |
1970 } | |
1971 | |
1972 return function->context()->native_context(); | |
1973 } | |
1974 | |
1975 | |
1960 void JSObject::EnqueueChangeRecord(Handle<JSObject> object, | 1976 void JSObject::EnqueueChangeRecord(Handle<JSObject> object, |
1961 const char* type_str, | 1977 const char* type_str, |
1962 Handle<Name> name, | 1978 Handle<Name> name, |
1963 Handle<Object> old_value) { | 1979 Handle<Object> old_value) { |
1964 Isolate* isolate = object->GetIsolate(); | 1980 Isolate* isolate = object->GetIsolate(); |
1965 HandleScope scope(isolate); | 1981 HandleScope scope(isolate); |
1966 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str); | 1982 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str); |
1967 if (object->IsJSGlobalObject()) { | 1983 if (object->IsJSGlobalObject()) { |
1968 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate); | 1984 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate); |
1969 } | 1985 } |
(...skipping 15253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17223 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17239 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17224 static const char* error_messages_[] = { | 17240 static const char* error_messages_[] = { |
17225 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17241 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17226 }; | 17242 }; |
17227 #undef ERROR_MESSAGES_TEXTS | 17243 #undef ERROR_MESSAGES_TEXTS |
17228 return error_messages_[reason]; | 17244 return error_messages_[reason]; |
17229 } | 17245 } |
17230 | 17246 |
17231 | 17247 |
17232 } } // namespace v8::internal | 17248 } } // namespace v8::internal |
OLD | NEW |