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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 1481383003: [runtime] [proxy] Adding [[SetPrototypeOf]] trap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: using new proxy method Created 5 years 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
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/proxies-set-prototype-of.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 isolate->heap()->exception()); 176 isolate->heap()->exception());
177 return *obj; 177 return *obj;
178 } 178 }
179 179
180 180
181 RUNTIME_FUNCTION(Runtime_SetPrototype) { 181 RUNTIME_FUNCTION(Runtime_SetPrototype) {
182 HandleScope scope(isolate); 182 HandleScope scope(isolate);
183 DCHECK(args.length() == 2); 183 DCHECK(args.length() == 2);
184 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); 184 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0);
185 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); 185 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
186 MAYBE_RETURN( 186 Maybe<bool> status =
187 JSReceiver::SetPrototype(obj, prototype, true, Object::THROW_ON_ERROR), 187 JSReceiver::SetPrototype(obj, prototype, true, Object::THROW_ON_ERROR);
188 isolate->heap()->exception()); 188 if (status.IsNothing()) return isolate->heap()->exception();
189 if (!status.FromJust()) {
190 THROW_NEW_ERROR_RETURN_FAILURE(
191 isolate,
192 NewTypeError(MessageTemplate::kProxySetPrototypeFailed, prototype));
193 }
189 return *obj; 194 return *obj;
190 } 195 }
191 196
192 197
193 // Enumerator used as indices into the array returned from GetOwnProperty 198 // Enumerator used as indices into the array returned from GetOwnProperty
194 enum PropertyDescriptorIndices { 199 enum PropertyDescriptorIndices {
195 IS_ACCESSOR_INDEX, 200 IS_ACCESSOR_INDEX,
196 VALUE_INDEX, 201 VALUE_INDEX,
197 GETTER_INDEX, 202 GETTER_INDEX,
198 SETTER_INDEX, 203 SETTER_INDEX,
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 1579
1575 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { 1580 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) {
1576 HandleScope scope(isolate); 1581 HandleScope scope(isolate);
1577 DCHECK(args.length() == 2); 1582 DCHECK(args.length() == 2);
1578 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1583 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1579 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1584 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1580 return JSReceiver::DefineProperties(isolate, o, properties); 1585 return JSReceiver::DefineProperties(isolate, o, properties);
1581 } 1586 }
1582 } // namespace internal 1587 } // namespace internal
1583 } // namespace v8 1588 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/proxies-set-prototype-of.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698