Skip to content

Commit

Permalink
Revert "Merge of source position information from kernel-sdk."
Browse files Browse the repository at this point in the history
The commit broke 2 tests:
vm/cc/IsolateReload_TypeIdentityGeneric
vm/cc/SourceReport_Coverage_AllFunctions_ForceCompile

This reverts commit 6fd3a42.

BUG=

Review URL: https://codereview.chromium.org/2517953002 .
  • Loading branch information
jensjoha committed Nov 21, 2016
1 parent 8da6379 commit 1056c56
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 296 deletions.
5 changes: 3 additions & 2 deletions runtime/vm/bootstrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ static RawError* BootstrapFromKernel(Thread* thread,
const uint8_t* buffer,
intptr_t buffer_size) {
Zone* zone = thread->zone();
kernel::KernelReader reader(buffer, buffer_size, true);
kernel::Program* program = reader.ReadPrecompiledProgram();
kernel::Program* program =
ReadPrecompiledKernelFromBuffer(buffer, buffer_size);
if (program == NULL) {
const String& message =
String::Handle(zone, String::New("Failed to read Kernel file"));
Expand All @@ -343,6 +343,7 @@ static RawError* BootstrapFromKernel(Thread* thread,
Library& library = Library::Handle(zone);
String& dart_name = String::Handle(zone);
String& kernel_name = String::Handle(zone);
kernel::KernelReader reader(NULL, -1, true);
for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) {
ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
library = isolate->object_store()->bootstrap_library(id);
Expand Down
5 changes: 3 additions & 2 deletions runtime/vm/bootstrap_nocore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ RawError* BootstrapFromKernel(Thread* thread,
const uint8_t* buffer,
intptr_t buffer_length) {
Zone* zone = thread->zone();
kernel::KernelReader reader(buffer, buffer_length, true);
kernel::Program* program = reader.ReadPrecompiledProgram();
kernel::Program* program =
ReadPrecompiledKernelFromBuffer(buffer, buffer_length);
if (program == NULL) {
const String& message =
String::Handle(zone, String::New("Failed to read Kernel file"));
Expand All @@ -81,6 +81,7 @@ RawError* BootstrapFromKernel(Thread* thread,
Library& library = Library::Handle(zone);
String& dart_name = String::Handle(zone);
String& kernel_name = String::Handle(zone);
kernel::KernelReader reader(NULL, -1, true);
for (intptr_t i = 0; i < bootstrap_library_count; ++i) {
ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
library = isolate->object_store()->bootstrap_library(id);
Expand Down
7 changes: 4 additions & 3 deletions runtime/vm/exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,12 @@ void Exceptions::CreateAndThrowTypeError(TokenPosition location,

DartFrameIterator iterator;
const Script& script = Script::Handle(zone, GetCallerScript(&iterator));
intptr_t line = -1;
intptr_t line;
intptr_t column = -1;
ASSERT(!script.IsNull());
if (location.IsReal()) {
if (script.HasSource()) {
script.GetTokenLocation(location, &line, &column);
} else {
script.GetTokenLocation(location, &line, NULL);
}
// Initialize '_url', '_line', and '_column' arguments.
args.SetAt(0, String::Handle(zone, script.url()));
Expand Down
28 changes: 8 additions & 20 deletions runtime/vm/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "platform/assert.h"
#include "vm/allocation.h"
#include "vm/globals.h"
#include "vm/token_position.h"


#define KERNEL_NODES_DO(M) \
Expand Down Expand Up @@ -309,7 +308,7 @@ class StringTable {

class LineStartingTable {
public:
void ReadFrom(Reader* reader);
void ReadFrom(Reader* reader, intptr_t length);
void WriteTo(Writer* writer);
~LineStartingTable() {
for (intptr_t i = 0; i < size_; ++i) {
Expand Down Expand Up @@ -414,7 +413,6 @@ class Library : public TreeNode {
virtual void VisitChildren(Visitor* visitor);

String* import_uri() { return import_uri_; }
intptr_t source_uri_index() { return source_uri_index_; }
String* name() { return name_; }
List<Class>& classes() { return classes_; }
List<Field>& fields() { return fields_; }
Expand Down Expand Up @@ -450,7 +448,6 @@ class Library : public TreeNode {

Ref<String> name_;
Ref<String> import_uri_;
intptr_t source_uri_index_;
List<Class> classes_;
List<Field> fields_;
List<Procedure> procedures_;
Expand All @@ -474,7 +471,6 @@ class Class : public TreeNode {

Library* parent() { return parent_; }
String* name() { return name_; }
intptr_t source_uri_index() { return source_uri_index_; }
bool is_abstract() { return is_abstract_; }
List<Expression>& annotations() { return annotations_; }

Expand All @@ -493,7 +489,6 @@ class Class : public TreeNode {

Ref<Library> parent_;
Ref<String> name_;
intptr_t source_uri_index_;
bool is_abstract_;
List<Expression> annotations_;

Expand Down Expand Up @@ -634,25 +629,21 @@ class Field : public Member {
bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; }
bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; }
bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; }
intptr_t source_uri_index() { return source_uri_index_; }

DartType* type() { return type_; }
InferredValue* inferred_value() { return inferred_value_; }
Expression* initializer() { return initializer_; }
TokenPosition position() { return position_; }

private:
Field() : position_(TokenPosition::kNoSource) {}
Field() {}

template <typename T>
friend class List;

word flags_;
intptr_t source_uri_index_;
Child<DartType> type_;
Child<InferredValue> inferred_value_;
Child<Expression> initializer_;
TokenPosition position_;

DISALLOW_COPY_AND_ASSIGN(Field);
};
Expand Down Expand Up @@ -734,7 +725,6 @@ class Procedure : public Member {
bool IsAbstract() { return (flags_ & kFlagAbstract) == kFlagAbstract; }
bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; }
bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; }
intptr_t source_uri_index() { return source_uri_index_; }

private:
Procedure() : kind_(kIncompleteProcedure), flags_(0), function_(NULL) {}
Expand All @@ -744,7 +734,6 @@ class Procedure : public Member {

ProcedureKind kind_;
word flags_;
intptr_t source_uri_index_;
Child<FunctionNode> function_;

DISALLOW_COPY_AND_ASSIGN(Procedure);
Expand Down Expand Up @@ -945,11 +934,9 @@ class Expression : public TreeNode {

virtual void AcceptTreeVisitor(TreeVisitor* visitor);
virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor) = 0;
TokenPosition position() { return position_; }

protected:
Expression() : position_(TokenPosition::kNoSource) {}
TokenPosition position_;
Expression() {}

private:
DISALLOW_COPY_AND_ASSIGN(Expression);
Expand Down Expand Up @@ -1294,6 +1281,11 @@ class StaticInvocation : public Expression {
public:
static StaticInvocation* ReadFrom(Reader* reader, bool is_const);
virtual void WriteTo(Writer* writer);

explicit StaticInvocation(Procedure* procedure,
Arguments* args,
bool is_const)
: procedure_(procedure), arguments_(args), is_const_(is_const) {}
~StaticInvocation();

virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
Expand Down Expand Up @@ -2793,8 +2785,6 @@ class Program : public TreeNode {
virtual void VisitChildren(Visitor* visitor);

StringTable& string_table() { return string_table_; }
StringTable& source_uri_table() { return source_uri_table_; }
LineStartingTable& line_starting_table() { return line_starting_table_; }
List<Library>& libraries() { return libraries_; }
Procedure* main_method() { return main_method_; }

Expand All @@ -2804,8 +2794,6 @@ class Program : public TreeNode {
List<Library> libraries_;
Ref<Procedure> main_method_;
StringTable string_table_;
StringTable source_uri_table_;
LineStartingTable line_starting_table_;

DISALLOW_COPY_AND_ASSIGN(Program);
};
Expand Down
Loading

0 comments on commit 1056c56

Please sign in to comment.