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 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 } | 1969 } |
1970 | 1970 |
1971 return function->context()->native_context(); | 1971 return function->context()->native_context(); |
1972 } | 1972 } |
1973 | 1973 |
1974 | 1974 |
1975 void JSObject::EnqueueChangeRecord(Handle<JSObject> object, | 1975 void JSObject::EnqueueChangeRecord(Handle<JSObject> object, |
1976 const char* type_str, | 1976 const char* type_str, |
1977 Handle<Name> name, | 1977 Handle<Name> name, |
1978 Handle<Object> old_value) { | 1978 Handle<Object> old_value) { |
| 1979 ASSERT(!object->IsJSGlobalProxy()); |
| 1980 ASSERT(!object->IsJSGlobalObject()); |
1979 Isolate* isolate = object->GetIsolate(); | 1981 Isolate* isolate = object->GetIsolate(); |
1980 HandleScope scope(isolate); | 1982 HandleScope scope(isolate); |
1981 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str); | 1983 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str); |
1982 if (object->IsJSGlobalObject()) { | |
1983 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate); | |
1984 } | |
1985 Handle<Object> args[] = { type, object, name, old_value }; | 1984 Handle<Object> args[] = { type, object, name, old_value }; |
1986 int argc = name.is_null() ? 2 : old_value->IsTheHole() ? 3 : 4; | 1985 int argc = name.is_null() ? 2 : old_value->IsTheHole() ? 3 : 4; |
1987 | 1986 |
1988 Execution::Call(isolate, | 1987 Execution::Call(isolate, |
1989 Handle<JSFunction>(isolate->observers_notify_change()), | 1988 Handle<JSFunction>(isolate->observers_notify_change()), |
1990 isolate->factory()->undefined_value(), | 1989 isolate->factory()->undefined_value(), |
1991 argc, args).Assert(); | 1990 argc, args).Assert(); |
1992 } | 1991 } |
1993 | 1992 |
1994 | 1993 |
(...skipping 3925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5920 dictionary->set_requires_slow_elements(); | 5919 dictionary->set_requires_slow_elements(); |
5921 // Freeze all elements in the dictionary | 5920 // Freeze all elements in the dictionary |
5922 FreezeDictionary(dictionary); | 5921 FreezeDictionary(dictionary); |
5923 } | 5922 } |
5924 | 5923 |
5925 return object; | 5924 return object; |
5926 } | 5925 } |
5927 | 5926 |
5928 | 5927 |
5929 void JSObject::SetObserved(Handle<JSObject> object) { | 5928 void JSObject::SetObserved(Handle<JSObject> object) { |
| 5929 ASSERT(!object->IsJSGlobalProxy()); |
| 5930 ASSERT(!object->IsJSGlobalObject()); |
5930 Isolate* isolate = object->GetIsolate(); | 5931 Isolate* isolate = object->GetIsolate(); |
5931 Handle<Map> new_map; | 5932 Handle<Map> new_map; |
5932 Handle<Map> old_map(object->map(), isolate); | 5933 Handle<Map> old_map(object->map(), isolate); |
5933 ASSERT(!old_map->is_observed()); | 5934 ASSERT(!old_map->is_observed()); |
5934 int transition_index = old_map->SearchTransition( | 5935 int transition_index = old_map->SearchTransition( |
5935 isolate->heap()->observed_symbol()); | 5936 isolate->heap()->observed_symbol()); |
5936 if (transition_index != TransitionArray::kNotFound) { | 5937 if (transition_index != TransitionArray::kNotFound) { |
5937 new_map = handle(old_map->GetTransition(transition_index), isolate); | 5938 new_map = handle(old_map->GetTransition(transition_index), isolate); |
5938 ASSERT(new_map->is_observed()); | 5939 ASSERT(new_map->is_observed()); |
5939 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) { | 5940 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) { |
(...skipping 11331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17271 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17272 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17272 static const char* error_messages_[] = { | 17273 static const char* error_messages_[] = { |
17273 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17274 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17274 }; | 17275 }; |
17275 #undef ERROR_MESSAGES_TEXTS | 17276 #undef ERROR_MESSAGES_TEXTS |
17276 return error_messages_[reason]; | 17277 return error_messages_[reason]; |
17277 } | 17278 } |
17278 | 17279 |
17279 | 17280 |
17280 } } // namespace v8::internal | 17281 } } // namespace v8::internal |
OLD | NEW |