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

Unified Diff: src/accessors.cc

Issue 119108: Add more debugging information to scripts compiled through eval (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/accessors.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.cc
===================================================================
--- src/accessors.cc (revision 2090)
+++ src/accessors.cc (working copy)
@@ -289,6 +289,24 @@
//
+// Accessors::ScriptCompilationType
+//
+
+
+Object* Accessors::ScriptGetCompilationType(Object* object, void*) {
+ Object* script = JSValue::cast(object)->value();
+ return Script::cast(script)->compilation_type();
+}
+
+
+const AccessorDescriptor Accessors::ScriptCompilationType = {
+ ScriptGetCompilationType,
+ IllegalSetter,
+ 0
+};
+
+
+//
// Accessors::ScriptGetLineEnds
//
@@ -314,9 +332,8 @@
Object* Accessors::ScriptGetContextData(Object* object, void*) {
- HandleScope scope;
- Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
- return script->context_data();
+ Object* script = JSValue::cast(object)->value();
+ return Script::cast(script)->context_data();
}
@@ -328,6 +345,54 @@
//
+// Accessors::ScriptGetEvalFromFunction
+//
+
+
+Object* Accessors::ScriptGetEvalFromFunction(Object* object, void*) {
+ Object* script = JSValue::cast(object)->value();
+ return Script::cast(script)->eval_from_function();
+}
+
+
+const AccessorDescriptor Accessors::ScriptEvalFromFunction = {
+ ScriptGetEvalFromFunction,
+ IllegalSetter,
+ 0
+};
+
+
+//
+// Accessors::ScriptGetEvalFromPosition
+//
+
+
+Object* Accessors::ScriptGetEvalFromPosition(Object* object, void*) {
+ HandleScope scope;
+ Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
+
+ // If this is not a script compiled through eval there is no eval position.
+ int compilation_type = Smi::cast(script->compilation_type())->value();
+ if (compilation_type != Script::COMPILATION_TYPE_EVAL) {
+ return Heap::undefined_value();
+ }
+
+ // 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());
+ return Smi::FromInt(code->SourcePosition(code->instruction_start() +
+ script->eval_from_instructions_offset()->value()));
+}
+
+
+const AccessorDescriptor Accessors::ScriptEvalFromPosition = {
+ ScriptGetEvalFromPosition,
+ IllegalSetter,
+ 0
+};
+
+
+//
// Accessors::FunctionPrototype
//
« no previous file with comments | « src/accessors.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698