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

Unified Diff: src/accessors.cc

Issue 1994973002: Revert of Refactor script position calculation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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
diff --git a/src/accessors.cc b/src/accessors.cc
index 0d9a62441c186fdcabed82934b64730ea79f63e3..8b8753b113ee6233e442f6495451e75b07d5f0d1 100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -438,6 +438,40 @@
//
+// Accessors::ScriptGetLineEnds
+//
+
+
+void Accessors::ScriptLineEndsGetter(
+ v8::Local<v8::Name> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
+ HandleScope scope(isolate);
+ Handle<Object> object = Utils::OpenHandle(*info.Holder());
+ Handle<Script> script(
+ Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
+ Script::InitLineEnds(script);
+ DCHECK(script->line_ends()->IsFixedArray());
+ Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
+ // We do not want anyone to modify this array from JS.
+ DCHECK(*line_ends == isolate->heap()->empty_fixed_array() ||
+ line_ends->map() == isolate->heap()->fixed_cow_array_map());
+ Handle<JSArray> js_array =
+ isolate->factory()->NewJSArrayWithElements(line_ends);
+ info.GetReturnValue().Set(Utils::ToLocal(js_array));
+}
+
+
+Handle<AccessorInfo> Accessors::ScriptLineEndsInfo(
+ Isolate* isolate, PropertyAttributes attributes) {
+ Handle<String> name(isolate->factory()->InternalizeOneByteString(
+ STATIC_CHAR_VECTOR("line_ends")));
+ return MakeAccessor(isolate, name, &ScriptLineEndsGetter, nullptr,
+ attributes);
+}
+
+
+//
// Accessors::ScriptSourceUrl
//
« 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