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

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

Issue 885643004: new classes: assert that constructors are not callable and rewrite 'return;' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix bit width Created 5 years, 10 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
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/harmony/classes-experimental.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 <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 33
34 RUNTIME_FUNCTION(Runtime_ThrowUnsupportedSuperError) { 34 RUNTIME_FUNCTION(Runtime_ThrowUnsupportedSuperError) {
35 HandleScope scope(isolate); 35 HandleScope scope(isolate);
36 DCHECK(args.length() == 0); 36 DCHECK(args.length() == 0);
37 return ThrowUnsupportedSuper(isolate); 37 return ThrowUnsupportedSuper(isolate);
38 } 38 }
39 39
40 40
41 RUNTIME_FUNCTION(Runtime_ThrowConstructorNonCallableError) {
42 HandleScope scope(isolate);
43 DCHECK(args.length() == 0);
44 THROW_NEW_ERROR_RETURN_FAILURE(
45 isolate,
46 NewTypeError("constructor_noncallable", HandleVector<Object>(NULL, 0)));
47 }
48
49
41 RUNTIME_FUNCTION(Runtime_ToMethod) { 50 RUNTIME_FUNCTION(Runtime_ToMethod) {
42 HandleScope scope(isolate); 51 HandleScope scope(isolate);
43 DCHECK(args.length() == 2); 52 DCHECK(args.length() == 2);
44 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); 53 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
45 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); 54 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
46 Handle<JSFunction> clone = JSFunction::CloneClosure(fun); 55 Handle<JSFunction> clone = JSFunction::CloneClosure(fun);
47 Handle<Symbol> home_object_symbol(isolate->heap()->home_object_symbol()); 56 Handle<Symbol> home_object_symbol(isolate->heap()->home_object_symbol());
48 JSObject::SetOwnPropertyIgnoreAttributes(clone, home_object_symbol, 57 JSObject::SetOwnPropertyIgnoreAttributes(clone, home_object_symbol,
49 home_object, DONT_ENUM).Assert(); 58 home_object, DONT_ENUM).Assert();
50 return *clone; 59 return *clone;
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 454 }
446 455
447 Handle<Object> result; 456 Handle<Object> result;
448 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 457 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
449 isolate, result, 458 isolate, result,
450 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); 459 Execution::Call(isolate, proto_function, receiver, argc, argv, false));
451 return *result; 460 return *result;
452 } 461 }
453 } 462 }
454 } // namespace v8::internal 463 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/harmony/classes-experimental.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698