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

Side by Side Diff: src/objects.cc

Issue 265503002: Re-enable Object.observe and add enforcement for security invariants. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cr comment Created 6 years, 7 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 | « src/objects.h ('k') | src/runtime.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 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
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 function = JSFunction::cast(this);
1967 } else {
1968 function = JSFunction::cast(constructor);
1969 }
1970
1971 return function->context()->native_context();
1972 }
1973
1974
1960 void JSObject::EnqueueChangeRecord(Handle<JSObject> object, 1975 void JSObject::EnqueueChangeRecord(Handle<JSObject> object,
1961 const char* type_str, 1976 const char* type_str,
1962 Handle<Name> name, 1977 Handle<Name> name,
1963 Handle<Object> old_value) { 1978 Handle<Object> old_value) {
1964 Isolate* isolate = object->GetIsolate(); 1979 Isolate* isolate = object->GetIsolate();
1965 HandleScope scope(isolate); 1980 HandleScope scope(isolate);
1966 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str); 1981 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str);
1967 if (object->IsJSGlobalObject()) { 1982 if (object->IsJSGlobalObject()) {
1968 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate); 1983 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate);
1969 } 1984 }
(...skipping 15273 matching lines...) Expand 10 before | Expand all | Expand 10 after
17243 #define ERROR_MESSAGES_TEXTS(C, T) T, 17258 #define ERROR_MESSAGES_TEXTS(C, T) T,
17244 static const char* error_messages_[] = { 17259 static const char* error_messages_[] = {
17245 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17260 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17246 }; 17261 };
17247 #undef ERROR_MESSAGES_TEXTS 17262 #undef ERROR_MESSAGES_TEXTS
17248 return error_messages_[reason]; 17263 return error_messages_[reason];
17249 } 17264 }
17250 17265
17251 17266
17252 } } // namespace v8::internal 17267 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698