Reviewers: Sven Panne,
Description:
remove Isolate::Current from most files starting with 'a'
R=svenpa...@chromium.org
BUG=
Please review this at https://codereview.chromium.org/23859002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/accessors.cc
M src/api.h
M src/api.cc
M src/arm/codegen-arm.h
M src/assembler.h
M src/ast.h
M src/ast.cc
M src/codegen.cc
M src/full-codegen.h
M src/full-codegen.cc
M src/hydrogen.cc
M src/mips/codegen-mips.h
M src/prettyprinter.h
M src/prettyprinter.cc
M src/rewriter.cc
M src/typing.cc
M src/x64/codegen-x64.h
Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index
45869ea63097fbdfee192f76d4f2f0cfc6581ccf..8f955d0c28936c2600ce38b0c1c958d950a79ef9
100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -850,15 +850,16 @@ Handle<AccessorInfo> Accessors::MakeModuleExport(
Handle<String> name,
int index,
PropertyAttributes attributes) {
- Factory* factory = name->GetIsolate()->factory();
+ Isolate* isolate = name->GetIsolate();
+ Factory* factory = isolate->factory();
Handle<ExecutableAccessorInfo> info =
factory->NewExecutableAccessorInfo();
info->set_property_attributes(attributes);
info->set_all_can_read(true);
info->set_all_can_write(true);
info->set_name(*name);
info->set_data(Smi::FromInt(index));
- Handle<Object> getter = v8::FromCData(&ModuleGetExport);
- Handle<Object> setter = v8::FromCData(&ModuleSetExport);
+ Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
+ Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
info->set_getter(*getter);
if (!(attributes & ReadOnly)) info->set_setter(*setter);
return info;
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
3e1f9fec982dbcc6231edcdd3bec8a85b8f601ab..aecb58ca9353b57f2d8d11da598895a54e2a39d2
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1264,7 +1264,7 @@ int TypeSwitch::match(v8::Handle<Value> value) {
#define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
- i::Handle<i::Object> foreign = FromCData(cdata); \
+ i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \
(obj)->setter(*foreign); \
} while (false)
Index: src/api.h
diff --git a/src/api.h b/src/api.h
index
63a29e473a22130b03d7518174fa74d37e940f89..51bc4942b24964007ac40736e103175521b4c337
100644
--- a/src/api.h
+++ b/src/api.h
@@ -125,8 +125,8 @@ template <typename T> inline T
ToCData(v8::internal::Object* obj) {
template <typename T>
-inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) {
- v8::internal::Isolate* isolate = v8::internal::Isolate::Current();
+inline v8::internal::Handle<v8::internal::Object> FromCData(
+ v8::internal::Isolate* isolate, T obj) {
STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
return isolate->factory()->NewForeign(
reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj)));
Index: src/arm/codegen-arm.h
diff --git a/src/arm/codegen-arm.h b/src/arm/codegen-arm.h
index
c020ab601c8e968ca492f02f30e9956ac63a2134..d9cc3872556d179b41e6ffb4ae97f4ee54e0adfe
100644
--- a/src/arm/codegen-arm.h
+++ b/src/arm/codegen-arm.h
@@ -44,8 +44,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
class CodeGenerator: public AstVisitor {
public:
- CodeGenerator() {
- InitializeAstVisitor();
+ explicit CodeGenerator(Isolate* isolate) {
+ InitializeAstVisitor(isolate);
}
static bool MakeCode(CompilationInfo* info);
Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index
b35813684ea2dcb3f7c1b25a01a89a796372b524..671f81346cd1f2f98198235c5531c6089d510cbc
100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -691,7 +691,7 @@ class ExternalReference BASE_EMBEDDED {
explicit ExternalReference(const SCTableReference& table_ref);
- // Isolate::Current() as an external reference.
+ // Isolate as an external reference.
static ExternalReference isolate_address(Isolate* isolate);
// One-of-a-kind references. These references are not part of a general
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index
873417119ccd197806f1ab86e632f202032f21fd..b966cc3d2db9582cc67cfcab7d7ad1d634cdf8a1
100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -1183,7 +1183,6 @@ void
AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
Handle<String> Literal::ToString() {
if (value_->IsString()) return Handle<String>::cast(value_);
- Factory* factory = Isolate::Current()->factory();
ASSERT(value_->IsNumber());
char arr[100];
Vector<char> buffer(arr, ARRAY_SIZE(arr));
@@ -1195,7 +1194,7 @@ Handle<String> Literal::ToString() {
} else {
str = DoubleToCString(value_->Number(), buffer);
}
- return factory->NewStringFromAscii(CStrVector(str));
+ return isolate_->factory()->NewStringFromAscii(CStrVector(str));
}
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index
bf76cfacd27aaf16ef7ad5e577e00f3950b9517c..f22c96ccdfc7a2f3972202844c500ab78bfab1ce
100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1381,12 +1381,15 @@ class Literal V8_FINAL : public Expression {
protected:
Literal(Isolate* isolate, Handle<Object> value)
: Expression(isolate),
- value_(value) { }
+ value_(value),
+ isolate_(isolate) { }
private:
Handle<String> ToString();
Handle<Object> value_;
+ // TODO(dcarney): remove. this is only needed for Match and Hash.
+ Isolate* isolate_;
};
@@ -2811,8 +2814,8 @@
public: \
} \
\
private: \
- void InitializeAstVisitor() { \
- isolate_ = Isolate::Current(); \
+ void InitializeAstVisitor(Isolate* isolate) { \
+ isolate_ = isolate; \
stack_overflow_ = false; \
} \
Isolate* isolate() { return isolate_; } \
Index: src/codegen.cc
diff --git a/src/codegen.cc b/src/codegen.cc
index
e988810b5742be2d0229bdfe576f5b958417a4de..6ec375105b2e6ee2e5ceba5ab0fe631b433602bd
100644
--- a/src/codegen.cc
+++ b/src/codegen.cc
@@ -89,12 +89,12 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo*
info, const char* kind) {
#ifdef DEBUG
if (!info->IsStub() && print_source) {
PrintF("--- Source from AST ---\n%s\n",
- PrettyPrinter().PrintProgram(info->function()));
+ PrettyPrinter(info->isolate()).PrintProgram(info->function()));
}
if (!info->IsStub() && print_ast) {
PrintF("--- AST ---\n%s\n",
- AstPrinter().PrintProgram(info->function()));
+ AstPrinter(info->isolate()).PrintProgram(info->function()));
}
#endif // DEBUG
}
Index: src/full-codegen.cc
diff --git a/src/full-codegen.cc b/src/full-codegen.cc
index
8846107acf8e90db9e631ca24347f3d5c5d60d57..f6a36f5dc1b9aa8644677bf58861d431cb3783c1
100644
--- a/src/full-codegen.cc
+++ b/src/full-codegen.cc
@@ -415,7 +415,7 @@ void FullCodeGenerator::Initialize() {
!Snapshot::HaveASnapshotToStartFrom();
masm_->set_emit_debug_code(generate_debug_code_);
masm_->set_predictable_code_size(true);
- InitializeAstVisitor();
+ InitializeAstVisitor(info_->isolate());
}
@@ -830,7 +830,7 @@ void FullCodeGenerator::SetStatementPosition(Statement*
stmt) {
} else {
// Check if the statement will be breakable without adding a debug
break
// slot.
- BreakableStatementChecker checker;
+ BreakableStatementChecker checker(isolate());
checker.Check(stmt);
// Record the statement position right here if the statement is not
// breakable. For breakable statements the actual recording of the
@@ -856,7 +856,7 @@ void
FullCodeGenerator::SetExpressionPosition(Expression* expr, int pos) {
} else {
// Check if the expression will be breakable without adding a debug
break
// slot.
- BreakableStatementChecker checker;
+ BreakableStatementChecker checker(isolate());
checker.Check(expr);
// Record a statement position right here if the expression is not
// breakable. For breakable expressions the actual recording of the
Index: src/full-codegen.h
diff --git a/src/full-codegen.h b/src/full-codegen.h
index
af63aedfbff2e4e6dafc0485b37191d8862a6104..ed2cc179213add60d4808615f386f0da2f6ee0f3
100644
--- a/src/full-codegen.h
+++ b/src/full-codegen.h
@@ -52,8 +52,8 @@ class JumpPatchSite;
// debugger to piggybag on.
class BreakableStatementChecker: public AstVisitor {
public:
- BreakableStatementChecker() : is_breakable_(false) {
- InitializeAstVisitor();
+ explicit BreakableStatementChecker(Isolate* isolate) :
is_breakable_(false) {
+ InitializeAstVisitor(isolate);
}
void Check(Statement* stmt);
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
feacefd68df18d79604da8a1a03af2a2ac9981d1..0b1fe09ed249aa6aa2bbb5911e33a8abe51ba4b7
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2040,7 +2040,7 @@
HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info)
// constructor for the initial state relies on function_state_ == NULL
// to know it's the initial state.
function_state_= &initial_function_state_;
- InitializeAstVisitor();
+ InitializeAstVisitor(info->isolate());
}
Index: src/mips/codegen-mips.h
diff --git a/src/mips/codegen-mips.h b/src/mips/codegen-mips.h
index
240b02ce44ba4e77d84d1b3c5bc800f347bea83f..950df21d307ef8be3994186706d69dfbd6df3e5a
100644
--- a/src/mips/codegen-mips.h
+++ b/src/mips/codegen-mips.h
@@ -46,8 +46,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
class CodeGenerator: public AstVisitor {
public:
- CodeGenerator() {
- InitializeAstVisitor();
+ explicit CodeGenerator(Isolate* isolate) {
+ InitializeAstVisitor(isolate);
}
static bool MakeCode(CompilationInfo* info);
Index: src/prettyprinter.cc
diff --git a/src/prettyprinter.cc b/src/prettyprinter.cc
index
1824efa7f5986dcefbe36da13b2c3feb351103d9..b1bac4cd4a70028d00151504d084303d5741e16f
100644
--- a/src/prettyprinter.cc
+++ b/src/prettyprinter.cc
@@ -38,11 +38,11 @@ namespace internal {
#ifdef DEBUG
-PrettyPrinter::PrettyPrinter() {
+PrettyPrinter::PrettyPrinter(Isolate* isolate) {
output_ = NULL;
size_ = 0;
pos_ = 0;
- InitializeAstVisitor();
+ InitializeAstVisitor(isolate);
}
@@ -480,8 +480,8 @@ const char*
PrettyPrinter::PrintProgram(FunctionLiteral* program) {
}
-void PrettyPrinter::PrintOut(AstNode* node) {
- PrettyPrinter printer;
+void PrettyPrinter::PrintOut(Isolate* isolate, AstNode* node) {
+ PrettyPrinter printer(isolate);
PrintF("%s", printer.Print(node));
}
@@ -658,7 +658,7 @@ class IndentedScope BASE_EMBEDDED {
//-----------------------------------------------------------------------------
-AstPrinter::AstPrinter() : indent_(0) {
+AstPrinter::AstPrinter(Isolate* isolate) : PrettyPrinter(isolate),
indent_(0) {
}
Index: src/prettyprinter.h
diff --git a/src/prettyprinter.h b/src/prettyprinter.h
index
6657ecd1458236793ab74fec3a09a11363f8b78c..b7ff2af5fa1af13941e0155b47063f4efb5ac51d
100644
--- a/src/prettyprinter.h
+++ b/src/prettyprinter.h
@@ -38,7 +38,7 @@ namespace internal {
class PrettyPrinter: public AstVisitor {
public:
- PrettyPrinter();
+ explicit PrettyPrinter(Isolate* isolate);
virtual ~PrettyPrinter();
// The following routines print a node into a string.
@@ -50,7 +50,7 @@ class PrettyPrinter: public AstVisitor {
void Print(const char* format, ...);
// Print a node to stdout.
- static void PrintOut(AstNode* node);
+ static void PrintOut(Isolate* isolate, AstNode* node);
// Individual nodes
#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
@@ -82,7 +82,7 @@ class PrettyPrinter: public AstVisitor {
// Prints the AST structure
class AstPrinter: public PrettyPrinter {
public:
- AstPrinter();
+ explicit AstPrinter(Isolate* isolate);
virtual ~AstPrinter();
const char* PrintProgram(FunctionLiteral* program);
Index: src/rewriter.cc
diff --git a/src/rewriter.cc b/src/rewriter.cc
index
df5c353415dda82878a5d2337287f0509f18092d..06335a80c7b38e658d78414f76a8a3c0a6a6d726
100644
--- a/src/rewriter.cc
+++ b/src/rewriter.cc
@@ -43,8 +43,8 @@ class Processor: public AstVisitor {
result_assigned_(false),
is_set_(false),
in_try_(false),
- factory_(Isolate::Current(), zone) {
- InitializeAstVisitor();
+ factory_(zone->isolate(), zone) {
+ InitializeAstVisitor(zone->isolate());
}
virtual ~Processor() { }
Index: src/typing.cc
diff --git a/src/typing.cc b/src/typing.cc
index
f8e2a7c206d80ee0e4b26096f97cb4173c88132f..34bb64bd7de022f8835c4320db07a64e5aeb9c64
100644
--- a/src/typing.cc
+++ b/src/typing.cc
@@ -42,7 +42,7 @@ AstTyper::AstTyper(CompilationInfo* info)
info->isolate(),
info->zone()),
store_(info->zone()) {
- InitializeAstVisitor();
+ InitializeAstVisitor(info->isolate());
}
Index: src/x64/codegen-x64.h
diff --git a/src/x64/codegen-x64.h b/src/x64/codegen-x64.h
index
9b8454a3535ac77a681439e8c2a8b986cb61d8d2..93d9aac536e5cb36254a177860fd3dac4f3703f5
100644
--- a/src/x64/codegen-x64.h
+++ b/src/x64/codegen-x64.h
@@ -44,8 +44,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
class CodeGenerator: public AstVisitor {
public:
- CodeGenerator() {
- InitializeAstVisitor();
+ explicit CodeGenerator(Isolate* isolate) {
+ InitializeAstVisitor(isolate);
}
static bool MakeCode(CompilationInfo* info);
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.