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

Unified Diff: src/accessors.cc

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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/SConscript ('k') | src/allocation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.cc
===================================================================
--- src/accessors.cc (revision 7267)
+++ src/accessors.cc (working copy)
@@ -34,7 +34,6 @@
#include "factory.h"
#include "safepoint-table.h"
#include "scopeinfo.h"
-#include "top.h"
namespace v8 {
namespace internal {
@@ -43,8 +42,9 @@
template <class C>
static C* FindInPrototypeChain(Object* obj, bool* found_it) {
ASSERT(!*found_it);
+ Heap* heap = HEAP;
while (!Is<C>(obj)) {
- if (obj == Heap::null_value()) return NULL;
+ if (obj == heap->null_value()) return NULL;
obj = obj->GetPrototype();
}
*found_it = true;
@@ -90,10 +90,10 @@
Object* Accessors::FlattenNumber(Object* value) {
if (value->IsNumber() || !value->IsJSValue()) return value;
JSValue* wrapper = JSValue::cast(value);
- ASSERT(
- Top::context()->global_context()->number_function()->has_initial_map());
- Map* number_map =
- Top::context()->global_context()->number_function()->initial_map();
+ ASSERT(Isolate::Current()->context()->global_context()->number_function()->
+ has_initial_map());
+ Map* number_map = Isolate::Current()->context()->global_context()->
+ number_function()->initial_map();
if (wrapper->map() == number_map) return wrapper->value();
return value;
}
@@ -126,12 +126,13 @@
// This means one of the object's prototypes is a JSArray and
// the object does not have a 'length' property.
// Calling SetProperty causes an infinite loop.
- return object->SetLocalPropertyIgnoreAttributes(Heap::length_symbol(),
+ return object->SetLocalPropertyIgnoreAttributes(HEAP->length_symbol(),
value, NONE);
}
}
- return Top::Throw(*Factory::NewRangeError("invalid_array_length",
- HandleVector<Object>(NULL, 0)));
+ return Isolate::Current()->Throw(
+ *FACTORY->NewRangeError("invalid_array_length",
+ HandleVector<Object>(NULL, 0)));
}
@@ -320,9 +321,9 @@
ASSERT(script->line_ends()->IsFixedArray());
Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
// We do not want anyone to modify this array from JS.
- ASSERT(*line_ends == Heap::empty_fixed_array() ||
- line_ends->map() == Heap::fixed_cow_array_map());
- Handle<JSArray> js_array = Factory::NewJSArrayWithElements(line_ends);
+ ASSERT(*line_ends == HEAP->empty_fixed_array() ||
+ line_ends->map() == HEAP->fixed_cow_array_map());
+ Handle<JSArray> js_array = FACTORY->NewJSArrayWithElements(line_ends);
return *js_array;
}
@@ -368,7 +369,7 @@
return *GetScriptWrapper(eval_from_script);
}
}
- return Heap::undefined_value();
+ return HEAP->undefined_value();
}
@@ -391,7 +392,7 @@
// If this is not a script compiled through eval there is no eval position.
int compilation_type = Smi::cast(script->compilation_type())->value();
if (compilation_type != Script::COMPILATION_TYPE_EVAL) {
- return Heap::undefined_value();
+ return HEAP->undefined_value();
}
// Get the function from where eval was called and find the source position
@@ -445,7 +446,7 @@
MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) {
bool found_it = false;
JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
- if (!found_it) return Heap::undefined_value();
+ if (!found_it) return HEAP->undefined_value();
while (!function->should_have_prototype()) {
found_it = false;
function = FindInPrototypeChain<JSFunction>(object->GetPrototype(),
@@ -456,7 +457,7 @@
if (!function->has_prototype()) {
Object* prototype;
- { MaybeObject* maybe_prototype = Heap::AllocateFunctionPrototype(function);
+ { MaybeObject* maybe_prototype = HEAP->AllocateFunctionPrototype(function);
if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype;
}
Object* result;
@@ -473,10 +474,10 @@
void*) {
bool found_it = false;
JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
- if (!found_it) return Heap::undefined_value();
+ if (!found_it) return HEAP->undefined_value();
if (!function->should_have_prototype()) {
// Since we hit this accessor, object will have no prototype property.
- return object->SetLocalPropertyIgnoreAttributes(Heap::prototype_symbol(),
+ return object->SetLocalPropertyIgnoreAttributes(HEAP->prototype_symbol(),
value,
NONE);
}
@@ -545,7 +546,7 @@
MaybeObject* Accessors::FunctionGetName(Object* object, void*) {
bool found_it = false;
JSFunction* holder = FindInPrototypeChain<JSFunction>(object, &found_it);
- if (!found_it) return Heap::undefined_value();
+ if (!found_it) return HEAP->undefined_value();
return holder->shared()->name();
}
@@ -604,13 +605,13 @@
if (Smi::IsValid(value)) {
return Handle<Object>(Smi::FromInt(value));
} else {
- return Factory::NewNumberFromInt(value);
+ return Isolate::Current()->factory()->NewNumberFromInt(value);
}
}
case DOUBLE: {
double value = Memory::double_at(addr_);
- return Factory::NewNumber(value);
+ return Isolate::Current()->factory()->NewNumber(value);
}
case LITERAL:
@@ -732,12 +733,13 @@
JavaScriptFrame* frame,
Handle<JSFunction> inlined_function,
int inlined_frame_index) {
+ Factory* factory = Isolate::Current()->factory();
int args_count = inlined_function->shared()->formal_parameter_count();
ScopedVector<SlotRef> args_slots(args_count);
ComputeSlotMappingForArguments(frame, inlined_frame_index, &args_slots);
Handle<JSObject> arguments =
- Factory::NewArgumentsObject(inlined_function, args_count);
- Handle<FixedArray> array = Factory::NewFixedArray(args_count);
+ factory->NewArgumentsObject(inlined_function, args_count);
+ Handle<FixedArray> array = factory->NewFixedArray(args_count);
for (int i = 0; i < args_count; ++i) {
Handle<Object> value = args_slots[i].GetValue();
array->set(i, *value);
@@ -750,11 +752,12 @@
MaybeObject* Accessors::FunctionGetArguments(Object* object, void*) {
- HandleScope scope;
+ Isolate* isolate = Isolate::Current();
+ HandleScope scope(isolate);
bool found_it = false;
JSFunction* holder = FindInPrototypeChain<JSFunction>(object, &found_it);
- if (!found_it) return Heap::undefined_value();
- Handle<JSFunction> function(holder);
+ if (!found_it) return isolate->heap()->undefined_value();
+ Handle<JSFunction> function(holder, isolate);
// Find the top invocation of the function by traversing frames.
List<JSFunction*> functions(2);
@@ -776,9 +779,9 @@
if (!frame->is_optimized()) {
// If there is an arguments variable in the stack, we return that.
Handle<SerializedScopeInfo> info(function->shared()->scope_info());
- int index = info->StackSlotIndex(Heap::arguments_symbol());
+ int index = info->StackSlotIndex(isolate->heap()->arguments_symbol());
if (index >= 0) {
- Handle<Object> arguments(frame->GetExpression(index));
+ Handle<Object> arguments(frame->GetExpression(index), isolate);
if (!arguments->IsArgumentsMarker()) return *arguments;
}
}
@@ -792,9 +795,9 @@
// Get the number of arguments and construct an arguments object
// mirror for the right frame.
const int length = frame->ComputeParametersCount();
- Handle<JSObject> arguments = Factory::NewArgumentsObject(function,
- length);
- Handle<FixedArray> array = Factory::NewFixedArray(length);
+ Handle<JSObject> arguments = isolate->factory()->NewArgumentsObject(
+ function, length);
+ Handle<FixedArray> array = isolate->factory()->NewFixedArray(length);
// Copy the parameters to the arguments object.
ASSERT(array->length() == length);
@@ -808,7 +811,7 @@
}
// No frame corresponding to the given function found. Return null.
- return Heap::null_value();
+ return isolate->heap()->null_value();
}
@@ -825,12 +828,13 @@
MaybeObject* Accessors::FunctionGetCaller(Object* object, void*) {
- HandleScope scope;
+ Isolate* isolate = Isolate::Current();
+ HandleScope scope(isolate);
AssertNoAllocation no_alloc;
bool found_it = false;
JSFunction* holder = FindInPrototypeChain<JSFunction>(object, &found_it);
- if (!found_it) return Heap::undefined_value();
- Handle<JSFunction> function(holder);
+ if (!found_it) return isolate->heap()->undefined_value();
+ Handle<JSFunction> function(holder, isolate);
List<JSFunction*> functions(2);
for (JavaScriptFrameIterator it; !it.done(); it.Advance()) {
@@ -854,7 +858,7 @@
}
ASSERT(functions.length() == 1);
}
- if (it.done()) return Heap::null_value();
+ if (it.done()) return isolate->heap()->null_value();
break;
}
}
@@ -863,7 +867,7 @@
}
// No frame corresponding to the given function found. Return null.
- return Heap::null_value();
+ return isolate->heap()->null_value();
}
« no previous file with comments | « src/SConscript ('k') | src/allocation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698