Revision: 3272
Author: [email protected]
Date: Wed Nov 11 01:19:39 2009
Log: Restore info needed to register profile ticks in functions from
the snapshot. Still needed: info to register profile ticks in
stubs.
Review URL: http://codereview.chromium.org/385035
http://code.google.com/p/v8/source/detail?r=3272
Modified:
/branches/bleeding_edge/src/accessors.cc
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/handles.cc
/branches/bleeding_edge/src/objects-debug.cc
/branches/bleeding_edge/src/objects-inl.h
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/v8.cc
=======================================
--- /branches/bleeding_edge/src/accessors.cc Wed Jun 24 01:01:38 2009
+++ /branches/bleeding_edge/src/accessors.cc Wed Nov 11 01:19:39 2009
@@ -315,7 +315,14 @@
HandleScope scope;
Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
InitScriptLineEnds(script);
- return script->line_ends();
+ if (script->line_ends_js_array()->IsUndefined()) {
+ Handle<FixedArray> line_ends_fixed_array(
+ FixedArray::cast(script->line_ends_fixed_array()));
+ Handle<FixedArray> copy =
Factory::CopyFixedArray(line_ends_fixed_array);
+ Handle<JSArray> js_array = Factory::NewJSArrayWithElements(copy);
+ script->set_line_ends_js_array(*js_array);
+ }
+ return script->line_ends_js_array();
}
=======================================
--- /branches/bleeding_edge/src/factory.cc Tue Nov 10 05:23:05 2009
+++ /branches/bleeding_edge/src/factory.cc Wed Nov 11 01:19:39 2009
@@ -188,7 +188,8 @@
script->set_type(Smi::FromInt(Script::TYPE_NORMAL));
script->set_compilation_type(Smi::FromInt(Script::COMPILATION_TYPE_HOST));
script->set_wrapper(*wrapper);
- script->set_line_ends(Heap::undefined_value());
+ script->set_line_ends_fixed_array(Heap::undefined_value());
+ script->set_line_ends_js_array(Heap::undefined_value());
script->set_eval_from_function(Heap::undefined_value());
script->set_eval_from_instructions_offset(Smi::FromInt(0));
=======================================
--- /branches/bleeding_edge/src/handles.cc Tue Nov 10 05:23:05 2009
+++ /branches/bleeding_edge/src/handles.cc Wed Nov 11 01:19:39 2009
@@ -427,12 +427,12 @@
// Init line_ends array with code positions of line ends inside script
// source.
void InitScriptLineEnds(Handle<Script> script) {
- if (!script->line_ends()->IsUndefined()) return;
+ if (!script->line_ends_fixed_array()->IsUndefined()) return;
if (!script->source()->IsString()) {
ASSERT(script->source()->IsUndefined());
- script->set_line_ends(*(Factory::NewJSArray(0)));
- ASSERT(script->line_ends()->IsJSArray());
+ script->set_line_ends_fixed_array(*(Factory::NewFixedArray(0)));
+ ASSERT(script->line_ends_fixed_array()->IsFixedArray());
return;
}
@@ -465,9 +465,8 @@
}
ASSERT(array_index == line_count);
- Handle<JSArray> object = Factory::NewJSArrayWithElements(array);
- script->set_line_ends(*object);
- ASSERT(script->line_ends()->IsJSArray());
+ script->set_line_ends_fixed_array(*array);
+ ASSERT(script->line_ends_fixed_array()->IsFixedArray());
}
@@ -475,17 +474,18 @@
int GetScriptLineNumber(Handle<Script> script, int code_pos) {
InitScriptLineEnds(script);
AssertNoAllocation no_allocation;
- JSArray* line_ends_array = JSArray::cast(script->line_ends());
- const int line_ends_len =
(Smi::cast(line_ends_array->length()))->value();
+ FixedArray* line_ends_array =
+ FixedArray::cast(script->line_ends_fixed_array());
+ const int line_ends_len = line_ends_array->length();
int line = -1;
if (line_ends_len > 0 &&
- code_pos <= (Smi::cast(line_ends_array->GetElement(0)))->value()) {
+ code_pos <= (Smi::cast(line_ends_array->get(0)))->value()) {
line = 0;
} else {
for (int i = 1; i < line_ends_len; ++i) {
- if ((Smi::cast(line_ends_array->GetElement(i - 1)))->value() <
code_pos &&
- code_pos <=
(Smi::cast(line_ends_array->GetElement(i)))->value()) {
+ if ((Smi::cast(line_ends_array->get(i - 1)))->value() < code_pos &&
+ code_pos <= (Smi::cast(line_ends_array->get(i)))->value()) {
line = i;
break;
}
=======================================
--- /branches/bleeding_edge/src/objects-debug.cc Wed Nov 11 01:00:09 2009
+++ /branches/bleeding_edge/src/objects-debug.cc Wed Nov 11 01:19:39 2009
@@ -1140,7 +1140,8 @@
VerifyPointer(data());
VerifyPointer(wrapper());
type()->SmiVerify();
- VerifyPointer(line_ends());
+ VerifyPointer(line_ends_fixed_array());
+ VerifyPointer(line_ends_js_array());
VerifyPointer(id());
}
=======================================
--- /branches/bleeding_edge/src/objects-inl.h Wed Nov 11 01:00:09 2009
+++ /branches/bleeding_edge/src/objects-inl.h Wed Nov 11 01:19:39 2009
@@ -2441,7 +2441,8 @@
ACCESSORS(Script, wrapper, Proxy, kWrapperOffset)
ACCESSORS(Script, type, Smi, kTypeOffset)
ACCESSORS(Script, compilation_type, Smi, kCompilationTypeOffset)
-ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
+ACCESSORS(Script, line_ends_fixed_array, Object, kLineEndsFixedArrayOffset)
+ACCESSORS(Script, line_ends_js_array, Object, kLineEndsJSArrayOffset)
ACCESSORS(Script, eval_from_function, Object, kEvalFromFunctionOffset)
ACCESSORS(Script, eval_from_instructions_offset, Smi,
kEvalFrominstructionsOffsetOffset)
=======================================
--- /branches/bleeding_edge/src/objects.h Wed Nov 11 01:00:09 2009
+++ /branches/bleeding_edge/src/objects.h Wed Nov 11 01:19:39 2009
@@ -3156,8 +3156,11 @@
// [compilation]: how the the script was compiled.
DECL_ACCESSORS(compilation_type, Smi)
- // [line_ends]: array of line ends positions.
- DECL_ACCESSORS(line_ends, Object)
+ // [line_ends]: FixedArray of line ends positions.
+ DECL_ACCESSORS(line_ends_fixed_array, Object)
+
+ // [line_ends]: JSArray of line ends positions.
+ DECL_ACCESSORS(line_ends_js_array, Object)
// [eval_from_function]: for eval scripts the funcion from which eval was
// called.
@@ -3187,8 +3190,16 @@
static const int kWrapperOffset = kContextOffset + kPointerSize;
static const int kTypeOffset = kWrapperOffset + kPointerSize;
static const int kCompilationTypeOffset = kTypeOffset + kPointerSize;
- static const int kLineEndsOffset = kCompilationTypeOffset + kPointerSize;
- static const int kIdOffset = kLineEndsOffset + kPointerSize;
+ // We have the line ends array both in FixedArray form and in JSArray
form.
+ // The FixedArray form is useful when we don't have a context and so
can't
+ // create a JSArray. The JSArray form is useful when we want to see the
+ // array from JS code (e.g. debug-delay.js) which cannot handle unboxed
+ // FixedArray objects.
+ static const int kLineEndsFixedArrayOffset =
+ kCompilationTypeOffset + kPointerSize;
+ static const int kLineEndsJSArrayOffset =
+ kLineEndsFixedArrayOffset + kPointerSize;
+ static const int kIdOffset = kLineEndsJSArrayOffset + kPointerSize;
static const int kEvalFromFunctionOffset = kIdOffset + kPointerSize;
static const int kEvalFrominstructionsOffsetOffset =
kEvalFromFunctionOffset + kPointerSize;
=======================================
--- /branches/bleeding_edge/src/v8.cc Thu Nov 5 05:59:40 2009
+++ /branches/bleeding_edge/src/v8.cc Wed Nov 11 01:19:39 2009
@@ -33,6 +33,7 @@
#include "simulator.h"
#include "stub-cache.h"
#include "oprofile-agent.h"
+#include "log.h"
namespace v8 {
namespace internal {
@@ -114,6 +115,11 @@
OProfileAgent::Initialize();
+ if (FLAG_log_code) {
+ HandleScope scope;
+ Logger::LogCompiledFunctions();
+ }
+
return true;
}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---