Index: src/runtime/runtime-classes.cc |
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc |
index 1b70f05a60d57d0dac197b3d2a4447a413dc7dc5..3db4330cec7d0f2a2e1f857b872d39f9164f805f 100644 |
--- a/src/runtime/runtime-classes.cc |
+++ b/src/runtime/runtime-classes.cc |
@@ -97,7 +97,6 @@ RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { |
static MaybeHandle<Object> DefineClass(Isolate* isolate, Handle<Object> name, |
Handle<Object> super_class, |
Handle<JSFunction> constructor, |
- Handle<Script> script, |
int start_position, int end_position) { |
Handle<Object> prototype_parent; |
Handle<Object> constructor_parent; |
@@ -182,11 +181,6 @@ static MaybeHandle<Object> DefineClass(Isolate* isolate, Handle<Object> name, |
// Install private properties that are used to construct the FunctionToString. |
RETURN_ON_EXCEPTION( |
- isolate, Object::SetProperty(constructor, |
- isolate->factory()->class_script_symbol(), |
- script, STRICT), |
- Object); |
- RETURN_ON_EXCEPTION( |
isolate, |
Object::SetProperty( |
constructor, isolate->factory()->class_start_position_symbol(), |
@@ -204,31 +198,29 @@ static MaybeHandle<Object> DefineClass(Isolate* isolate, Handle<Object> name, |
RUNTIME_FUNCTION(Runtime_DefineClass) { |
HandleScope scope(isolate); |
- DCHECK(args.length() == 6); |
+ DCHECK(args.length() == 5); |
CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); |
CONVERT_ARG_HANDLE_CHECKED(Object, super_class, 1); |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 2); |
- CONVERT_ARG_HANDLE_CHECKED(Script, script, 3); |
- CONVERT_SMI_ARG_CHECKED(start_position, 4); |
- CONVERT_SMI_ARG_CHECKED(end_position, 5); |
+ CONVERT_SMI_ARG_CHECKED(start_position, 3); |
+ CONVERT_SMI_ARG_CHECKED(end_position, 4); |
Handle<Object> result; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
isolate, result, DefineClass(isolate, name, super_class, constructor, |
- script, start_position, end_position)); |
+ start_position, end_position)); |
return *result; |
} |
RUNTIME_FUNCTION(Runtime_DefineClassStrong) { |
HandleScope scope(isolate); |
- DCHECK(args.length() == 6); |
+ DCHECK(args.length() == 5); |
CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); |
CONVERT_ARG_HANDLE_CHECKED(Object, super_class, 1); |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 2); |
- CONVERT_ARG_HANDLE_CHECKED(Script, script, 3); |
- CONVERT_SMI_ARG_CHECKED(start_position, 4); |
- CONVERT_SMI_ARG_CHECKED(end_position, 5); |
+ CONVERT_SMI_ARG_CHECKED(start_position, 3); |
+ CONVERT_SMI_ARG_CHECKED(end_position, 4); |
if (super_class->IsNull()) { |
THROW_NEW_ERROR_RETURN_FAILURE( |
@@ -238,7 +230,7 @@ RUNTIME_FUNCTION(Runtime_DefineClassStrong) { |
Handle<Object> result; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
isolate, result, DefineClass(isolate, name, super_class, constructor, |
- script, start_position, end_position)); |
+ start_position, end_position)); |
return *result; |
} |
@@ -283,32 +275,20 @@ RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { |
DCHECK(args.length() == 1); |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
- Handle<Object> script; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, script, |
- Object::GetProperty(fun, isolate->factory()->class_script_symbol())); |
- if (!script->IsScript()) { |
- return isolate->heap()->undefined_value(); |
- } |
- |
Handle<Symbol> start_position_symbol( |
isolate->heap()->class_start_position_symbol()); |
- Handle<Object> start_position; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, start_position, Object::GetProperty(fun, start_position_symbol)); |
+ Handle<Object> start_position = |
+ JSReceiver::GetDataProperty(fun, start_position_symbol); |
+ if (!start_position->IsSmi()) return isolate->heap()->undefined_value(); |
Handle<Symbol> end_position_symbol( |
isolate->heap()->class_end_position_symbol()); |
- Handle<Object> end_position; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, end_position, Object::GetProperty(fun, end_position_symbol)); |
- |
- if (!start_position->IsSmi() || !end_position->IsSmi() || |
- !Handle<Script>::cast(script)->HasValidSource()) { |
- return isolate->ThrowIllegalOperation(); |
- } |
+ Handle<Object> end_position = |
+ JSReceiver::GetDataProperty(fun, end_position_symbol); |
+ CHECK(end_position->IsSmi()); |
- Handle<String> source(String::cast(Handle<Script>::cast(script)->source())); |
+ Handle<String> source( |
+ String::cast(Script::cast(fun->shared()->script())->source())); |
return *isolate->factory()->NewSubString( |
source, Handle<Smi>::cast(start_position)->value(), |
Handle<Smi>::cast(end_position)->value()); |