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(
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;
......
......@@ -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)
......
......@@ -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)));
......
......@@ -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);
......
......@@ -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
......
......@@ -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));
}
......
......@@ -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_; } \
......
......@@ -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
}
......
......@@ -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
......
......@@ -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);
......
......@@ -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());
}
......
......@@ -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);
......
......@@ -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) {
}
......
......@@ -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);
......
......@@ -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() { }
......
......@@ -42,7 +42,7 @@ AstTyper::AstTyper(CompilationInfo* info)
info->isolate(),
info->zone()),
store_(info->zone()) {
InitializeAstVisitor();
InitializeAstVisitor(info->isolate());
}
......
......@@ -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);
......
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