| Index: src/accessors.cc
|
| ===================================================================
|
| --- src/accessors.cc (revision 3390)
|
| +++ src/accessors.cc (working copy)
|
| @@ -349,29 +349,38 @@
|
|
|
|
|
| //
|
| -// Accessors::ScriptGetEvalFromFunction
|
| +// Accessors::ScriptGetEvalFromScript
|
| //
|
|
|
|
|
| -Object* Accessors::ScriptGetEvalFromFunction(Object* object, void*) {
|
| +Object* Accessors::ScriptGetEvalFromScript(Object* object, void*) {
|
| Object* script = JSValue::cast(object)->value();
|
| - return Script::cast(script)->eval_from_function();
|
| + if (!Script::cast(script)->eval_from_shared()->IsUndefined()) {
|
| + Handle<SharedFunctionInfo> eval_from_shared(
|
| + SharedFunctionInfo::cast(Script::cast(script)->eval_from_shared()));
|
| +
|
| + if (eval_from_shared->script()->IsScript()) {
|
| + Handle<Script> eval_from_script(Script::cast(eval_from_shared->script()));
|
| + return *GetScriptWrapper(eval_from_script);
|
| + }
|
| + }
|
| + return Heap::undefined_value();
|
| }
|
|
|
|
|
| -const AccessorDescriptor Accessors::ScriptEvalFromFunction = {
|
| - ScriptGetEvalFromFunction,
|
| +const AccessorDescriptor Accessors::ScriptEvalFromScript = {
|
| + ScriptGetEvalFromScript,
|
| IllegalSetter,
|
| 0
|
| };
|
|
|
|
|
| //
|
| -// Accessors::ScriptGetEvalFromPosition
|
| +// Accessors::ScriptGetEvalFromScriptPosition
|
| //
|
|
|
|
|
| -Object* Accessors::ScriptGetEvalFromPosition(Object* object, void*) {
|
| +Object* Accessors::ScriptGetEvalFromScriptPosition(Object* object, void*) {
|
| HandleScope scope;
|
| Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
|
|
|
| @@ -383,20 +392,48 @@
|
|
|
| // Get the function from where eval was called and find the source position
|
| // from the instruction offset.
|
| - Handle<Code> code(JSFunction::cast(script->eval_from_function())->code());
|
| + Handle<Code> code(SharedFunctionInfo::cast(
|
| + script->eval_from_shared())->code());
|
| return Smi::FromInt(code->SourcePosition(code->instruction_start() +
|
| script->eval_from_instructions_offset()->value()));
|
| }
|
|
|
|
|
| -const AccessorDescriptor Accessors::ScriptEvalFromPosition = {
|
| - ScriptGetEvalFromPosition,
|
| +const AccessorDescriptor Accessors::ScriptEvalFromScriptPosition = {
|
| + ScriptGetEvalFromScriptPosition,
|
| IllegalSetter,
|
| 0
|
| };
|
|
|
|
|
| //
|
| +// Accessors::ScriptGetEvalFromFunctionName
|
| +//
|
| +
|
| +
|
| +Object* Accessors::ScriptGetEvalFromFunctionName(Object* object, void*) {
|
| + Object* script = JSValue::cast(object)->value();
|
| + Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(
|
| + Script::cast(script)->eval_from_shared()));
|
| +
|
| +
|
| + // Find the name of the function calling eval.
|
| + if (!shared->name()->IsUndefined()) {
|
| + return shared->name();
|
| + } else {
|
| + return shared->inferred_name();
|
| + }
|
| +}
|
| +
|
| +
|
| +const AccessorDescriptor Accessors::ScriptEvalFromFunctionName = {
|
| + ScriptGetEvalFromFunctionName,
|
| + IllegalSetter,
|
| + 0
|
| +};
|
| +
|
| +
|
| +//
|
| // Accessors::FunctionPrototype
|
| //
|
|
|
|
|