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

Side by Side Diff: src/api.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 | « no previous file | src/messages.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "api.h" 5 #include "api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #include <cmath> // For isnan. 8 #include <cmath> // For isnan.
9 #include "../include/v8-debug.h" 9 #include "../include/v8-debug.h"
10 #include "../include/v8-profiler.h" 10 #include "../include/v8-profiler.h"
(...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after
3560 ENTER_V8(isolate); 3560 ENTER_V8(isolate);
3561 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3561 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3562 EXCEPTION_PREAMBLE(isolate); 3562 EXCEPTION_PREAMBLE(isolate);
3563 i::Handle<i::JSObject> result = isolate->factory()->CopyJSObject(self); 3563 i::Handle<i::JSObject> result = isolate->factory()->CopyJSObject(self);
3564 has_pending_exception = result.is_null(); 3564 has_pending_exception = result.is_null();
3565 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); 3565 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
3566 return Utils::ToLocal(result); 3566 return Utils::ToLocal(result);
3567 } 3567 }
3568 3568
3569 3569
3570 static i::Context* GetCreationContext(i::JSObject* object) {
3571 i::Object* constructor = object->map()->constructor();
3572 i::JSFunction* function;
3573 if (!constructor->IsJSFunction()) {
3574 // Functions have null as a constructor,
3575 // but any JSFunction knows its context immediately.
3576 ASSERT(object->IsJSFunction());
3577 function = i::JSFunction::cast(object);
3578 } else {
3579 function = i::JSFunction::cast(constructor);
3580 }
3581 return function->context()->native_context();
3582 }
3583
3584
3585 Local<v8::Context> v8::Object::CreationContext() { 3570 Local<v8::Context> v8::Object::CreationContext() {
3586 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3571 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3587 ON_BAILOUT(isolate, 3572 ON_BAILOUT(isolate,
3588 "v8::Object::CreationContext()", return Local<v8::Context>()); 3573 "v8::Object::CreationContext()", return Local<v8::Context>());
3589 ENTER_V8(isolate); 3574 ENTER_V8(isolate);
3590 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3575 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3591 i::Context* context = GetCreationContext(*self); 3576 i::Context* context = self->GetCreationContext();
3592 return Utils::ToLocal(i::Handle<i::Context>(context)); 3577 return Utils::ToLocal(i::Handle<i::Context>(context));
3593 } 3578 }
3594 3579
3595 3580
3596 int v8::Object::GetIdentityHash() { 3581 int v8::Object::GetIdentityHash() {
3597 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3582 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3598 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); 3583 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0);
3599 ENTER_V8(isolate); 3584 ENTER_V8(isolate);
3600 i::HandleScope scope(isolate); 3585 i::HandleScope scope(isolate);
3601 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3586 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
(...skipping 3980 matching lines...) Expand 10 before | Expand all | Expand 10 after
7582 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7567 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7583 Address callback_address = 7568 Address callback_address =
7584 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7569 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7585 VMState<EXTERNAL> state(isolate); 7570 VMState<EXTERNAL> state(isolate);
7586 ExternalCallbackScope call_scope(isolate, callback_address); 7571 ExternalCallbackScope call_scope(isolate, callback_address);
7587 callback(info); 7572 callback(info);
7588 } 7573 }
7589 7574
7590 7575
7591 } } // namespace v8::internal 7576 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698