OLD | NEW |
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 <stdlib.h> | 7 #include <stdlib.h> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 HandleScope scope(isolate); | 67 HandleScope scope(isolate); |
68 DCHECK(args.length() == 1); | 68 DCHECK(args.length() == 1); |
69 CONVERT_ARG_HANDLE_CHECKED(Name, name, 0); | 69 CONVERT_ARG_HANDLE_CHECKED(Name, name, 0); |
70 if (Name::Equals(name, isolate->factory()->prototype_string())) { | 70 if (Name::Equals(name, isolate->factory()->prototype_string())) { |
71 return ThrowStaticPrototypeError(isolate); | 71 return ThrowStaticPrototypeError(isolate); |
72 } | 72 } |
73 return *name; | 73 return *name; |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 RUNTIME_FUNCTION(Runtime_ToMethod) { | |
78 HandleScope scope(isolate); | |
79 DCHECK(args.length() == 2); | |
80 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | |
81 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); | |
82 Handle<JSFunction> clone = JSFunction::CloneClosure(fun); | |
83 Handle<Symbol> home_object_symbol(isolate->factory()->home_object_symbol()); | |
84 JSObject::SetOwnPropertyIgnoreAttributes(clone, home_object_symbol, | |
85 home_object, DONT_ENUM).Assert(); | |
86 return *clone; | |
87 } | |
88 | |
89 | |
90 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { | 77 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { |
91 DCHECK(args.length() == 0); | 78 DCHECK(args.length() == 0); |
92 return isolate->heap()->home_object_symbol(); | 79 return isolate->heap()->home_object_symbol(); |
93 } | 80 } |
94 | 81 |
95 | 82 |
96 static MaybeHandle<Object> DefineClass(Isolate* isolate, Handle<Object> name, | 83 static MaybeHandle<Object> DefineClass(Isolate* isolate, Handle<Object> name, |
97 Handle<Object> super_class, | 84 Handle<Object> super_class, |
98 Handle<JSFunction> constructor, | 85 Handle<JSFunction> constructor, |
99 int start_position, int end_position) { | 86 int start_position, int end_position) { |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 510 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
524 isolate, result, | 511 isolate, result, |
525 Execution::New(isolate, super_constructor, original_constructor, | 512 Execution::New(isolate, super_constructor, original_constructor, |
526 argument_count, arguments.get())); | 513 argument_count, arguments.get())); |
527 | 514 |
528 return *result; | 515 return *result; |
529 } | 516 } |
530 | 517 |
531 } // namespace internal | 518 } // namespace internal |
532 } // namespace v8 | 519 } // namespace v8 |
OLD | NEW |