Commit f4e16f24 authored by dcarney@chromium.org's avatar dcarney@chromium.org

remove Isolate::Current from most files starting with 'a'

R=svenpanne@chromium.org
BUG=

Review URL: https://codereview.chromium.org/23859002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16463 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f119b0ea
...@@ -896,15 +896,16 @@ Handle<AccessorInfo> Accessors::MakeModuleExport( ...@@ -896,15 +896,16 @@ Handle<AccessorInfo> Accessors::MakeModuleExport(
Handle<String> name, Handle<String> name,
int index, int index,
PropertyAttributes attributes) { PropertyAttributes attributes) {
Factory* factory = name->GetIsolate()->factory(); Isolate* isolate = name->GetIsolate();
Factory* factory = isolate->factory();
Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo(); Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo();
info->set_property_attributes(attributes); info->set_property_attributes(attributes);
info->set_all_can_read(true); info->set_all_can_read(true);
info->set_all_can_write(true); info->set_all_can_write(true);
info->set_name(*name); info->set_name(*name);
info->set_data(Smi::FromInt(index)); info->set_data(Smi::FromInt(index));
Handle<Object> getter = v8::FromCData(&ModuleGetExport); Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
Handle<Object> setter = v8::FromCData(&ModuleSetExport); Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
info->set_getter(*getter); info->set_getter(*getter);
if (!(attributes & ReadOnly)) info->set_setter(*setter); if (!(attributes & ReadOnly)) info->set_setter(*setter);
return info; return info;
......
...@@ -1264,7 +1264,7 @@ int TypeSwitch::match(v8::Handle<Value> value) { ...@@ -1264,7 +1264,7 @@ int TypeSwitch::match(v8::Handle<Value> value) {
#define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ #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); \ (obj)->setter(*foreign); \
} while (false) } while (false)
......
...@@ -125,8 +125,8 @@ template <typename T> inline T ToCData(v8::internal::Object* obj) { ...@@ -125,8 +125,8 @@ template <typename T> inline T ToCData(v8::internal::Object* obj) {
template <typename T> template <typename T>
inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) { inline v8::internal::Handle<v8::internal::Object> FromCData(
v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); v8::internal::Isolate* isolate, T obj) {
STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
return isolate->factory()->NewForeign( return isolate->factory()->NewForeign(
reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj))); reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj)));
......
...@@ -44,8 +44,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; ...@@ -44,8 +44,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
class CodeGenerator: public AstVisitor { class CodeGenerator: public AstVisitor {
public: public:
CodeGenerator() { explicit CodeGenerator(Isolate* isolate) {
InitializeAstVisitor(); InitializeAstVisitor(isolate);
} }
static bool MakeCode(CompilationInfo* info); static bool MakeCode(CompilationInfo* info);
......
...@@ -691,7 +691,7 @@ class ExternalReference BASE_EMBEDDED { ...@@ -691,7 +691,7 @@ class ExternalReference BASE_EMBEDDED {
explicit ExternalReference(const SCTableReference& table_ref); explicit ExternalReference(const SCTableReference& table_ref);
// Isolate::Current() as an external reference. // Isolate as an external reference.
static ExternalReference isolate_address(Isolate* isolate); static ExternalReference isolate_address(Isolate* isolate);
// One-of-a-kind references. These references are not part of a general // One-of-a-kind references. These references are not part of a general
......
...@@ -1183,7 +1183,6 @@ void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { ...@@ -1183,7 +1183,6 @@ void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
Handle<String> Literal::ToString() { Handle<String> Literal::ToString() {
if (value_->IsString()) return Handle<String>::cast(value_); if (value_->IsString()) return Handle<String>::cast(value_);
Factory* factory = Isolate::Current()->factory();
ASSERT(value_->IsNumber()); ASSERT(value_->IsNumber());
char arr[100]; char arr[100];
Vector<char> buffer(arr, ARRAY_SIZE(arr)); Vector<char> buffer(arr, ARRAY_SIZE(arr));
...@@ -1195,7 +1194,7 @@ Handle<String> Literal::ToString() { ...@@ -1195,7 +1194,7 @@ Handle<String> Literal::ToString() {
} else { } else {
str = DoubleToCString(value_->Number(), buffer); str = DoubleToCString(value_->Number(), buffer);
} }
return factory->NewStringFromAscii(CStrVector(str)); return isolate_->factory()->NewStringFromAscii(CStrVector(str));
} }
......
...@@ -1381,12 +1381,15 @@ class Literal V8_FINAL : public Expression { ...@@ -1381,12 +1381,15 @@ class Literal V8_FINAL : public Expression {
protected: protected:
Literal(Isolate* isolate, Handle<Object> value) Literal(Isolate* isolate, Handle<Object> value)
: Expression(isolate), : Expression(isolate),
value_(value) { } value_(value),
isolate_(isolate) { }
private: private:
Handle<String> ToString(); Handle<String> ToString();
Handle<Object> value_; Handle<Object> value_;
// TODO(dcarney): remove. this is only needed for Match and Hash.
Isolate* isolate_;
}; };
...@@ -2811,8 +2814,8 @@ public: \ ...@@ -2811,8 +2814,8 @@ public: \
} \ } \
\ \
private: \ private: \
void InitializeAstVisitor() { \ void InitializeAstVisitor(Isolate* isolate) { \
isolate_ = Isolate::Current(); \ isolate_ = isolate; \
stack_overflow_ = false; \ stack_overflow_ = false; \
} \ } \
Isolate* isolate() { return isolate_; } \ Isolate* isolate() { return isolate_; } \
......
...@@ -89,12 +89,12 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) { ...@@ -89,12 +89,12 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
#ifdef DEBUG #ifdef DEBUG
if (!info->IsStub() && print_source) { if (!info->IsStub() && print_source) {
PrintF("--- Source from AST ---\n%s\n", PrintF("--- Source from AST ---\n%s\n",
PrettyPrinter().PrintProgram(info->function())); PrettyPrinter(info->isolate()).PrintProgram(info->function()));
} }
if (!info->IsStub() && print_ast) { if (!info->IsStub() && print_ast) {
PrintF("--- AST ---\n%s\n", PrintF("--- AST ---\n%s\n",
AstPrinter().PrintProgram(info->function())); AstPrinter(info->isolate()).PrintProgram(info->function()));
} }
#endif // DEBUG #endif // DEBUG
} }
......
...@@ -415,7 +415,7 @@ void FullCodeGenerator::Initialize() { ...@@ -415,7 +415,7 @@ void FullCodeGenerator::Initialize() {
!Snapshot::HaveASnapshotToStartFrom(); !Snapshot::HaveASnapshotToStartFrom();
masm_->set_emit_debug_code(generate_debug_code_); masm_->set_emit_debug_code(generate_debug_code_);
masm_->set_predictable_code_size(true); masm_->set_predictable_code_size(true);
InitializeAstVisitor(); InitializeAstVisitor(info_->isolate());
} }
...@@ -830,7 +830,7 @@ void FullCodeGenerator::SetStatementPosition(Statement* stmt) { ...@@ -830,7 +830,7 @@ void FullCodeGenerator::SetStatementPosition(Statement* stmt) {
} else { } else {
// Check if the statement will be breakable without adding a debug break // Check if the statement will be breakable without adding a debug break
// slot. // slot.
BreakableStatementChecker checker; BreakableStatementChecker checker(isolate());
checker.Check(stmt); checker.Check(stmt);
// Record the statement position right here if the statement is not // Record the statement position right here if the statement is not
// breakable. For breakable statements the actual recording of the // breakable. For breakable statements the actual recording of the
...@@ -856,7 +856,7 @@ void FullCodeGenerator::SetExpressionPosition(Expression* expr, int pos) { ...@@ -856,7 +856,7 @@ void FullCodeGenerator::SetExpressionPosition(Expression* expr, int pos) {
} else { } else {
// Check if the expression will be breakable without adding a debug break // Check if the expression will be breakable without adding a debug break
// slot. // slot.
BreakableStatementChecker checker; BreakableStatementChecker checker(isolate());
checker.Check(expr); checker.Check(expr);
// Record a statement position right here if the expression is not // Record a statement position right here if the expression is not
// breakable. For breakable expressions the actual recording of the // breakable. For breakable expressions the actual recording of the
......
...@@ -52,8 +52,8 @@ class JumpPatchSite; ...@@ -52,8 +52,8 @@ class JumpPatchSite;
// debugger to piggybag on. // debugger to piggybag on.
class BreakableStatementChecker: public AstVisitor { class BreakableStatementChecker: public AstVisitor {
public: public:
BreakableStatementChecker() : is_breakable_(false) { explicit BreakableStatementChecker(Isolate* isolate) : is_breakable_(false) {
InitializeAstVisitor(); InitializeAstVisitor(isolate);
} }
void Check(Statement* stmt); void Check(Statement* stmt);
......
...@@ -2040,7 +2040,7 @@ HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info) ...@@ -2040,7 +2040,7 @@ HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info)
// constructor for the initial state relies on function_state_ == NULL // constructor for the initial state relies on function_state_ == NULL
// to know it's the initial state. // to know it's the initial state.
function_state_= &initial_function_state_; function_state_= &initial_function_state_;
InitializeAstVisitor(); InitializeAstVisitor(info->isolate());
} }
......
...@@ -46,8 +46,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; ...@@ -46,8 +46,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
class CodeGenerator: public AstVisitor { class CodeGenerator: public AstVisitor {
public: public:
CodeGenerator() { explicit CodeGenerator(Isolate* isolate) {
InitializeAstVisitor(); InitializeAstVisitor(isolate);
} }
static bool MakeCode(CompilationInfo* info); static bool MakeCode(CompilationInfo* info);
......
...@@ -38,11 +38,11 @@ namespace internal { ...@@ -38,11 +38,11 @@ namespace internal {
#ifdef DEBUG #ifdef DEBUG
PrettyPrinter::PrettyPrinter() { PrettyPrinter::PrettyPrinter(Isolate* isolate) {
output_ = NULL; output_ = NULL;
size_ = 0; size_ = 0;
pos_ = 0; pos_ = 0;
InitializeAstVisitor(); InitializeAstVisitor(isolate);
} }
...@@ -480,8 +480,8 @@ const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) { ...@@ -480,8 +480,8 @@ const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) {
} }
void PrettyPrinter::PrintOut(AstNode* node) { void PrettyPrinter::PrintOut(Isolate* isolate, AstNode* node) {
PrettyPrinter printer; PrettyPrinter printer(isolate);
PrintF("%s", printer.Print(node)); PrintF("%s", printer.Print(node));
} }
...@@ -658,7 +658,7 @@ class IndentedScope BASE_EMBEDDED { ...@@ -658,7 +658,7 @@ class IndentedScope BASE_EMBEDDED {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
AstPrinter::AstPrinter() : indent_(0) { AstPrinter::AstPrinter(Isolate* isolate) : PrettyPrinter(isolate), indent_(0) {
} }
......
...@@ -38,7 +38,7 @@ namespace internal { ...@@ -38,7 +38,7 @@ namespace internal {
class PrettyPrinter: public AstVisitor { class PrettyPrinter: public AstVisitor {
public: public:
PrettyPrinter(); explicit PrettyPrinter(Isolate* isolate);
virtual ~PrettyPrinter(); virtual ~PrettyPrinter();
// The following routines print a node into a string. // The following routines print a node into a string.
...@@ -50,7 +50,7 @@ class PrettyPrinter: public AstVisitor { ...@@ -50,7 +50,7 @@ class PrettyPrinter: public AstVisitor {
void Print(const char* format, ...); void Print(const char* format, ...);
// Print a node to stdout. // Print a node to stdout.
static void PrintOut(AstNode* node); static void PrintOut(Isolate* isolate, AstNode* node);
// Individual nodes // Individual nodes
#define DECLARE_VISIT(type) virtual void Visit##type(type* node); #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
...@@ -82,7 +82,7 @@ class PrettyPrinter: public AstVisitor { ...@@ -82,7 +82,7 @@ class PrettyPrinter: public AstVisitor {
// Prints the AST structure // Prints the AST structure
class AstPrinter: public PrettyPrinter { class AstPrinter: public PrettyPrinter {
public: public:
AstPrinter(); explicit AstPrinter(Isolate* isolate);
virtual ~AstPrinter(); virtual ~AstPrinter();
const char* PrintProgram(FunctionLiteral* program); const char* PrintProgram(FunctionLiteral* program);
......
...@@ -43,8 +43,8 @@ class Processor: public AstVisitor { ...@@ -43,8 +43,8 @@ class Processor: public AstVisitor {
result_assigned_(false), result_assigned_(false),
is_set_(false), is_set_(false),
in_try_(false), in_try_(false),
factory_(Isolate::Current(), zone) { factory_(zone->isolate(), zone) {
InitializeAstVisitor(); InitializeAstVisitor(zone->isolate());
} }
virtual ~Processor() { } virtual ~Processor() { }
......
...@@ -42,7 +42,7 @@ AstTyper::AstTyper(CompilationInfo* info) ...@@ -42,7 +42,7 @@ AstTyper::AstTyper(CompilationInfo* info)
info->isolate(), info->isolate(),
info->zone()), info->zone()),
store_(info->zone()) { store_(info->zone()) {
InitializeAstVisitor(); InitializeAstVisitor(info->isolate());
} }
......
...@@ -44,8 +44,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; ...@@ -44,8 +44,8 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
class CodeGenerator: public AstVisitor { class CodeGenerator: public AstVisitor {
public: public:
CodeGenerator() { explicit CodeGenerator(Isolate* isolate) {
InitializeAstVisitor(); InitializeAstVisitor(isolate);
} }
static bool MakeCode(CompilationInfo* info); static bool MakeCode(CompilationInfo* info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment