Revision: 16513
Author: [email protected]
Date: Wed Sep 4 07:05:11 2013 UTC
Log: remove Isolate::Current from most files starting with 'o'
through 'r'
[email protected]
BUG=
Review URL: https://codereview.chromium.org/23757017
http://code.google.com/p/v8/source/detail?r=16513
Modified:
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/builtins.cc
/branches/bleeding_edge/src/execution.cc
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/json-stringifier.h
/branches/bleeding_edge/src/liveedit.cc
/branches/bleeding_edge/src/log.cc
/branches/bleeding_edge/src/objects-debug.cc
/branches/bleeding_edge/src/objects-inl.h
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/parser.cc
/branches/bleeding_edge/src/parser.h
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/test/cctest/test-api.cc
/branches/bleeding_edge/test/cctest/test-heap.cc
/branches/bleeding_edge/test/cctest/test-parsing.cc
=======================================
--- /branches/bleeding_edge/src/api.cc Tue Sep 3 09:45:55 2013 UTC
+++ /branches/bleeding_edge/src/api.cc Wed Sep 4 07:05:11 2013 UTC
@@ -1683,19 +1683,20 @@
ScriptData* ScriptData::PreCompile(const char* input, int length) {
i::Utf8ToUtf16CharacterStream stream(
reinterpret_cast<const unsigned char*>(input), length);
- return i::PreParserApi::PreParse(&stream);
+ return i::PreParserApi::PreParse(i::Isolate::Current(), &stream);
}
ScriptData* ScriptData::PreCompile(v8::Handle<String> source) {
i::Handle<i::String> str = Utils::OpenHandle(*source);
+ i::Isolate* isolate = str->GetIsolate();
if (str->IsExternalTwoByteString()) {
i::ExternalTwoByteStringUtf16CharacterStream stream(
i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
- return i::PreParserApi::PreParse(&stream);
+ return i::PreParserApi::PreParse(isolate, &stream);
} else {
i::GenericStringUtf16CharacterStream stream(str, 0, str->length());
- return i::PreParserApi::PreParse(&stream);
+ return i::PreParserApi::PreParse(isolate, &stream);
}
}
@@ -2289,7 +2290,7 @@
ENTER_V8(isolate);
HandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSArray> self = Utils::OpenHandle(this);
- i::Object* raw_object = self->GetElementNoExceptionThrown(index);
+ i::Object* raw_object = self->GetElementNoExceptionThrown(isolate,
index);
i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object));
return scope.Close(Utils::StackFrameToLocal(obj));
}
@@ -3362,7 +3363,7 @@
ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
EXCEPTION_PREAMBLE(isolate);
- i::Handle<i::Object> result = i::Object::GetElement(self, index);
+ i::Handle<i::Object> result = i::Object::GetElement(isolate, self,
index);
has_pending_exception = result.is_null();
EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
return Utils::ToLocal(result);
=======================================
--- /branches/bleeding_edge/src/builtins.cc Tue Sep 3 13:33:54 2013 UTC
+++ /branches/bleeding_edge/src/builtins.cc Wed Sep 4 07:05:11 2013 UTC
@@ -594,7 +594,7 @@
if (accessor->HasElement(array, array, new_length, elms_obj)) {
maybe_result = accessor->Get(array, array, new_length, elms_obj);
} else {
- maybe_result = array->GetPrototype()->GetElement(len - 1);
+ maybe_result = array->GetPrototype()->GetElement(isolate, len - 1);
}
if (maybe_result->IsFailure()) return maybe_result;
MaybeObject* maybe_failure =
=======================================
--- /branches/bleeding_edge/src/execution.cc Tue Sep 3 06:59:01 2013 UTC
+++ /branches/bleeding_edge/src/execution.cc Wed Sep 4 07:05:11 2013 UTC
@@ -708,7 +708,7 @@
int serial_number = Smi::cast(data->serial_number())->value();
Object* elm =
isolate->native_context()->function_cache()->
- GetElementNoExceptionThrown(serial_number);
+ GetElementNoExceptionThrown(isolate, serial_number);
if (elm->IsJSFunction()) return
Handle<JSFunction>(JSFunction::cast(elm));
// The function has not yet been instantiated in this context; do it.
Handle<Object> args[] = { data };
=======================================
--- /branches/bleeding_edge/src/factory.cc Tue Sep 3 08:49:44 2013 UTC
+++ /branches/bleeding_edge/src/factory.cc Wed Sep 4 07:05:11 2013 UTC
@@ -806,7 +806,7 @@
*p++ = ' ';
space--;
if (space > 0) {
- MaybeObject* maybe_arg = args->GetElement(i);
+ MaybeObject* maybe_arg = args->GetElement(isolate(), i);
Handle<String> arg_str(reinterpret_cast<String*>(maybe_arg));
const char* arg = *arg_str->ToCString();
Vector<char> v2(p, static_cast<int>(space));
@@ -1321,7 +1321,7 @@
Handle<Object> Factory::ToObject(Handle<Object> object) {
- CALL_HEAP_FUNCTION(isolate(), object->ToObject(), Object);
+ CALL_HEAP_FUNCTION(isolate(), object->ToObject(isolate()), Object);
}
=======================================
--- /branches/bleeding_edge/src/ic.cc Tue Sep 3 13:33:54 2013 UTC
+++ /branches/bleeding_edge/src/ic.cc Wed Sep 4 07:05:11 2013 UTC
@@ -566,7 +566,7 @@
// the element if so.
uint32_t index;
if (name->AsArrayIndex(&index)) {
- Handle<Object> result = Object::GetElement(object, index);
+ Handle<Object> result = Object::GetElement(isolate(), object, index);
RETURN_IF_EMPTY_HANDLE(isolate(), result);
if (result->IsJSFunction()) return *result;
=======================================
--- /branches/bleeding_edge/src/json-stringifier.h Tue Sep 3 06:59:01 2013
UTC
+++ /branches/bleeding_edge/src/json-stringifier.h Wed Sep 4 07:05:11 2013
UTC
@@ -602,12 +602,12 @@
Handle<JSArray> object, int length) {
for (int i = 0; i < length; i++) {
if (i > 0) Append(',');
- Handle<Object> element = Object::GetElement(object, i);
+ Handle<Object> element = Object::GetElement(isolate_, object, i);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate_, element, EXCEPTION);
if (element->IsUndefined()) {
AppendAscii("null");
} else {
- Result result = SerializeElement(object->GetIsolate(), element, i);
+ Result result = SerializeElement(isolate_, element, i);
if (result == SUCCESS) continue;
if (result == UNCHANGED) {
AppendAscii("null");
@@ -678,9 +678,10 @@
key_handle = factory_->NumberToString(Handle<Object>(key,
isolate_));
uint32_t index;
if (key->IsSmi()) {
- property = Object::GetElement(object, Smi::cast(key)->value());
+ property = Object::GetElement(
+ isolate_, object, Smi::cast(key)->value());
} else if (key_handle->AsArrayIndex(&index)) {
- property = Object::GetElement(object, index);
+ property = Object::GetElement(isolate_, object, index);
} else {
property = GetProperty(isolate_, object, key_handle);
}
=======================================
--- /branches/bleeding_edge/src/liveedit.cc Thu Aug 22 12:16:00 2013 UTC
+++ /branches/bleeding_edge/src/liveedit.cc Wed Sep 4 07:05:11 2013 UTC
@@ -691,7 +691,7 @@
Handle<Smi>(Smi::FromInt(value), isolate()));
}
Object* GetField(int field_position) {
- return array_->GetElementNoExceptionThrown(field_position);
+ return array_->GetElementNoExceptionThrown(isolate(), field_position);
}
int GetSmiValueField(int field_position) {
Object* res = GetField(field_position);
@@ -788,7 +788,8 @@
public:
static bool IsInstance(Handle<JSArray> array) {
return array->length() == Smi::FromInt(kSize_) &&
-
array->GetElementNoExceptionThrown(kSharedInfoOffset_)->IsJSValue();
+ array->GetElementNoExceptionThrown(
+ array->GetIsolate(), kSharedInfoOffset_)->IsJSValue();
}
explicit SharedInfoWrapper(Handle<JSArray> array)
@@ -846,7 +847,8 @@
HandleScope scope(isolate());
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(
- result_->GetElementNoExceptionThrown(current_parent_index_));
+ result_->GetElementNoExceptionThrown(
+ isolate(), current_parent_index_));
current_parent_index_ = info.GetParentIndex();
}
@@ -855,7 +857,8 @@
void FunctionCode(Handle<Code> function_code) {
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(
- result_->GetElementNoExceptionThrown(current_parent_index_));
+ result_->GetElementNoExceptionThrown(
+ isolate(), current_parent_index_));
info.SetFunctionCode(function_code,
Handle<Object>(isolate()->heap()->null_value(),
isolate()));
@@ -870,7 +873,8 @@
}
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(
- result_->GetElementNoExceptionThrown(current_parent_index_));
+ result_->GetElementNoExceptionThrown(
+ isolate(), current_parent_index_));
info.SetFunctionCode(Handle<Code>(shared->code()),
Handle<Object>(shared->scope_info(), isolate()));
info.SetSharedFunctionInfo(shared);
@@ -1001,11 +1005,13 @@
void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) {
- HandleScope scope(array->GetIsolate());
+ Isolate* isolate = array->GetIsolate();
+ HandleScope scope(isolate);
int len = GetArrayLength(array);
for (int i = 0; i < len; i++) {
Handle<SharedFunctionInfo> info(
- SharedFunctionInfo::cast(array->GetElementNoExceptionThrown(i)));
+ SharedFunctionInfo::cast(
+ array->GetElementNoExceptionThrown(array->GetIsolate(), i)));
SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create();
Handle<String> name_handle(String::cast(info->name()));
info_wrapper.SetProperties(name_handle, info->start_position(),
@@ -1360,20 +1366,24 @@
Handle<JSArray> position_change_array) {
int position_diff = 0;
int array_len = GetArrayLength(position_change_array);
+ Isolate* isolate = position_change_array->GetIsolate();
// TODO(635): binary search may be used here
for (int i = 0; i < array_len; i += 3) {
- Object* element =
position_change_array->GetElementNoExceptionThrown(i);
+ Object* element =
+ position_change_array->GetElementNoExceptionThrown(isolate, i);
CHECK(element->IsSmi());
int chunk_start = Smi::cast(element)->value();
if (original_position < chunk_start) {
break;
}
- element = position_change_array->GetElementNoExceptionThrown(i + 1);
+ element = position_change_array->GetElementNoExceptionThrown(isolate,
+ i + 1);
CHECK(element->IsSmi());
int chunk_end = Smi::cast(element)->value();
// Position mustn't be inside a chunk.
ASSERT(original_position >= chunk_end);
- element = position_change_array->GetElementNoExceptionThrown(i + 2);
+ element = position_change_array->GetElementNoExceptionThrown(isolate,
+ i + 2);
CHECK(element->IsSmi());
int chunk_changed_end = Smi::cast(element)->value();
position_diff = chunk_changed_end - chunk_end;
@@ -1630,7 +1640,8 @@
Isolate* isolate = shared_info_array->GetIsolate();
int len = GetArrayLength(shared_info_array);
for (int i = 0; i < len; i++) {
- Object* element = shared_info_array->GetElementNoExceptionThrown(i);
+ Object* element =
+ shared_info_array->GetElementNoExceptionThrown(isolate, i);
CHECK(element->IsJSValue());
Handle<JSValue> jsvalue(JSValue::cast(element));
Handle<SharedFunctionInfo> shared =
@@ -1949,7 +1960,7 @@
// Replace "blocked on active" with "replaced on active" status.
for (int i = 0; i < array_len; i++) {
- if (result->GetElement(i) ==
+ if (result->GetElement(result->GetIsolate(), i) ==
Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) {
Handle<Object> replaced(
Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK),
isolate);
=======================================
--- /branches/bleeding_edge/src/log.cc Mon Sep 2 12:26:06 2013 UTC
+++ /branches/bleeding_edge/src/log.cc Wed Sep 4 07:05:11 2013 UTC
@@ -974,7 +974,7 @@
if (c == '%' && i <= format.length() - 2) {
i++;
ASSERT('0' <= format[i] && format[i] <= '9');
- MaybeObject* maybe = args->GetElement(format[i] - '0');
+ MaybeObject* maybe = args->GetElement(isolate_, format[i] - '0');
Object* obj;
if (!maybe->ToObject(&obj)) {
msg.Append("<exception>");
=======================================
--- /branches/bleeding_edge/src/objects-debug.cc Mon Sep 2 10:35:34 2013
UTC
+++ /branches/bleeding_edge/src/objects-debug.cc Wed Sep 4 07:05:11 2013
UTC
@@ -501,7 +501,7 @@
}
if (cache_stamp()->IsSmi()) {
CHECK(Smi::cast(cache_stamp())->value() <=
- Smi::cast(Isolate::Current()->date_cache()->stamp())->value());
+ Smi::cast(GetIsolate()->date_cache()->stamp())->value());
}
}
=======================================
--- /branches/bleeding_edge/src/objects-inl.h Tue Sep 3 11:54:08 2013 UTC
+++ /branches/bleeding_edge/src/objects-inl.h Wed Sep 4 07:05:11 2013 UTC
@@ -917,17 +917,17 @@
}
-MaybeObject* Object::GetElement(uint32_t index) {
+MaybeObject* Object::GetElement(Isolate* isolate, uint32_t index) {
// GetElement can trigger a getter which can cause allocation.
// This was not always the case. This ASSERT is here to catch
// leftover incorrect uses.
ASSERT(AllowHeapAllocation::IsAllowed());
- return GetElementWithReceiver(this, index);
+ return GetElementWithReceiver(isolate, this, index);
}
-Object* Object::GetElementNoExceptionThrown(uint32_t index) {
- MaybeObject* maybe = GetElementWithReceiver(this, index);
+Object* Object::GetElementNoExceptionThrown(Isolate* isolate, uint32_t
index) {
+ MaybeObject* maybe = GetElementWithReceiver(isolate, this, index);
ASSERT(!maybe->IsFailure());
Object* result = NULL; // Initialization to please compiler.
maybe->ToObject(&result);
@@ -4840,7 +4840,7 @@
bool SharedFunctionInfo::is_compiled() {
return code() !=
- Isolate::Current()->builtins()->builtin(Builtins::kLazyCompile);
+ GetIsolate()->builtins()->builtin(Builtins::kLazyCompile);
}
=======================================
--- /branches/bleeding_edge/src/objects.cc Tue Sep 3 11:47:16 2013 UTC
+++ /branches/bleeding_edge/src/objects.cc Wed Sep 4 07:05:11 2013 UTC
@@ -83,23 +83,19 @@
}
-MaybeObject* Object::ToObject() {
+MaybeObject* Object::ToObject(Isolate* isolate) {
if (IsJSReceiver()) {
return this;
} else if (IsNumber()) {
- Isolate* isolate = Isolate::Current();
Context* native_context = isolate->context()->native_context();
return CreateJSValue(native_context->number_function(), this);
} else if (IsBoolean()) {
- Isolate* isolate = HeapObject::cast(this)->GetIsolate();
Context* native_context = isolate->context()->native_context();
return CreateJSValue(native_context->boolean_function(), this);
} else if (IsString()) {
- Isolate* isolate = HeapObject::cast(this)->GetIsolate();
Context* native_context = isolate->context()->native_context();
return CreateJSValue(native_context->string_function(), this);
} else if (IsSymbol()) {
- Isolate* isolate = HeapObject::cast(this)->GetIsolate();
Context* native_context = isolate->context()->native_context();
return CreateJSValue(native_context->symbol_function(), this);
}
@@ -135,7 +131,7 @@
} else if (IsBoolean()) {
holder = native_context->boolean_function()->instance_prototype();
} else {
- Isolate::Current()->PushStackTraceAndDie(
+ result->isolate()->PushStackTraceAndDie(
0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001);
}
}
@@ -422,24 +418,22 @@
}
-Handle<Object> Object::GetProperty(Handle<Object> object, Handle<Name>
name) {
+Handle<Object> Object::GetProperty(Handle<Object> object,
+ Handle<Name> name) {
// TODO(rossberg): The index test should not be here but in the
GetProperty
// method (or somewhere else entirely). Needs more global clean-up.
uint32_t index;
+ Isolate* isolate = name->GetIsolate();
if (name->AsArrayIndex(&index))
- return GetElement(object, index);
- Isolate* isolate = object->IsHeapObject()
- ? Handle<HeapObject>::cast(object)->GetIsolate()
- : Isolate::Current();
+ return GetElement(isolate, object, index);
CALL_HEAP_FUNCTION(isolate, object->GetProperty(*name), Object);
}
-Handle<Object> Object::GetElement(Handle<Object> object, uint32_t index) {
- Isolate* isolate = object->IsHeapObject()
- ? Handle<HeapObject>::cast(object)->GetIsolate()
- : Isolate::Current();
- CALL_HEAP_FUNCTION(isolate, object->GetElement(index), Object);
+Handle<Object> Object::GetElement(Isolate* isolate,
+ Handle<Object> object,
+ uint32_t index) {
+ CALL_HEAP_FUNCTION(isolate, object->GetElement(isolate, index), Object);
}
@@ -801,9 +795,7 @@
LookupResult* result,
Handle<Name> key,
PropertyAttributes* attributes) {
- Isolate* isolate = object->IsHeapObject()
- ? Handle<HeapObject>::cast(object)->GetIsolate()
- : Isolate::Current();
+ Isolate* isolate = result->isolate();
CALL_HEAP_FUNCTION(
isolate,
object->GetProperty(*receiver, result, *key, attributes),
@@ -816,9 +808,7 @@
LookupResult* result,
Handle<Name> key,
PropertyAttributes* attributes) {
- Isolate* isolate = object->IsHeapObject()
- ? Handle<HeapObject>::cast(object)->GetIsolate()
- : Isolate::Current();
+ Isolate* isolate = result->isolate();
CALL_HEAP_FUNCTION_PASS_EXCEPTION(
isolate,
object->GetProperty(*receiver, result, *key, attributes));
@@ -910,10 +900,9 @@
}
-MaybeObject* Object::GetElementWithReceiver(Object* receiver, uint32_t
index) {
- Isolate* isolate = IsSmi()
- ? Isolate::Current()
- : HeapObject::cast(this)->GetIsolate();
+MaybeObject* Object::GetElementWithReceiver(Isolate* isolate,
+ Object* receiver,
+ uint32_t index) {
Heap* heap = isolate->heap();
Object* holder = this;
@@ -4067,7 +4056,8 @@
PropertyAttributes old_attributes = ABSENT;
bool is_observed = FLAG_harmony_observation &&
self->map()->is_observed();
if (is_observed && lookup.IsProperty()) {
- if (lookup.IsDataProperty()) old_value = Object::GetProperty(self,
name);
+ if (lookup.IsDataProperty()) old_value =
+ Object::GetProperty(self, name);
old_attributes = lookup.GetAttributes();
}
@@ -5093,7 +5083,7 @@
if (should_enqueue_change_record) {
old_value = object->GetLocalElementAccessorPair(index) != NULL
? Handle<Object>::cast(factory->the_hole_value())
- : Object::GetElement(object, index);
+ : Object::GetElement(isolate, object, index);
}
}
@@ -6129,7 +6119,7 @@
if (is_element) {
preexists = object->HasLocalElement(index);
if (preexists && object->GetLocalElementAccessorPair(index) == NULL)
{
- old_value = Object::GetElement(object, index);
+ old_value = Object::GetElement(isolate, object, index);
}
} else {
LookupResult lookup(isolate);
@@ -10965,7 +10955,7 @@
ASSERT(attributes != ABSENT);
if (attributes == DONT_DELETE) return false;
old_values->Add(object->GetLocalElementAccessorPair(index) == NULL
- ? Object::GetElement(object, index)
+ ? Object::GetElement(isolate, object, index)
: Handle<Object>::cast(isolate->factory()->the_hole_value()));
indices->Add(index);
return true;
@@ -12205,7 +12195,7 @@
if (old_attributes != ABSENT) {
if (self->GetLocalElementAccessorPair(index) == NULL)
- old_value = Object::GetElement(self, index);
+ old_value = Object::GetElement(isolate, self, index);
} else if (self->IsJSArray()) {
// Store old array length in case adding an element grows the array.
old_length_handle = handle(Handle<JSArray>::cast(self)->length(),
isolate);
@@ -12247,7 +12237,7 @@
} else if (old_value->IsTheHole()) {
EnqueueChangeRecord(self, "reconfigured", name, old_value);
} else {
- Handle<Object> new_value = Object::GetElement(self, index);
+ Handle<Object> new_value = Object::GetElement(isolate, self, index);
bool value_changed = !old_value->SameValue(*new_value);
if (old_attributes != new_attributes) {
if (!value_changed) old_value = isolate->factory()->the_hole_value();
@@ -12575,7 +12565,7 @@
Object* pt = holder_handle->GetPrototype();
if (pt == heap->null_value()) return heap->undefined_value();
- return pt->GetElementWithReceiver(*this_handle, index);
+ return pt->GetElementWithReceiver(isolate, *this_handle, index);
}
=======================================
--- /branches/bleeding_edge/src/objects.h Mon Sep 2 16:32:11 2013 UTC
+++ /branches/bleeding_edge/src/objects.h Wed Sep 4 07:05:11 2013 UTC
@@ -1436,8 +1436,8 @@
inline bool HasSpecificClassOf(String* name);
- MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9.
- bool BooleanValue(); // ECMA-262 9.2.
+ MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262
9.9.
+ bool BooleanValue(); // ECMA-262
9.2.
// Convert to a JSObject if needed.
// native_context is used when creating wrapper object.
@@ -1459,7 +1459,8 @@
Name* key,
PropertyAttributes* attributes);
- static Handle<Object> GetProperty(Handle<Object> object, Handle<Name>
key);
+ static Handle<Object> GetProperty(Handle<Object> object,
+ Handle<Name> key);
static Handle<Object> GetProperty(Handle<Object> object,
Handle<Object> receiver,
LookupResult* result,
@@ -1481,11 +1482,15 @@
MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object*
receiver,
JSReceiver*
getter);
- static Handle<Object> GetElement(Handle<Object> object, uint32_t index);
- MUST_USE_RESULT inline MaybeObject* GetElement(uint32_t index);
+ static Handle<Object> GetElement(Isolate* isolate,
+ Handle<Object> object,
+ uint32_t index);
+ MUST_USE_RESULT inline MaybeObject* GetElement(Isolate* isolate,
+ uint32_t index);
// For use when we know that no exception can be thrown.
- inline Object* GetElementNoExceptionThrown(uint32_t index);
- MUST_USE_RESULT MaybeObject* GetElementWithReceiver(Object* receiver,
+ inline Object* GetElementNoExceptionThrown(Isolate* isolate, uint32_t
index);
+ MUST_USE_RESULT MaybeObject* GetElementWithReceiver(Isolate* isolate,
+ Object* receiver,
uint32_t index);
// Return the object's prototype (might be Heap::null_value()).
=======================================
--- /branches/bleeding_edge/src/parser.cc Thu Aug 29 09:15:13 2013 UTC
+++ /branches/bleeding_edge/src/parser.cc Wed Sep 4 07:05:11 2013 UTC
@@ -3744,8 +3744,9 @@
}
-Handle<FixedArray> CompileTimeValue::GetValue(Expression* expression) {
- Factory* factory = Isolate::Current()->factory();
+Handle<FixedArray> CompileTimeValue::GetValue(Isolate* isolate,
+ Expression* expression) {
+ Factory* factory = isolate->factory();
ASSERT(IsCompileTimeValue(expression));
Handle<FixedArray> result = factory->NewFixedArray(2, TENURED);
ObjectLiteral* object_literal = expression->AsObjectLiteral();
@@ -3784,7 +3785,7 @@
return expression->AsLiteral()->value();
}
if (CompileTimeValue::IsCompileTimeValue(expression)) {
- return CompileTimeValue::GetValue(expression);
+ return CompileTimeValue::GetValue(isolate(), expression);
}
return isolate()->factory()->uninitialized_value();
}
@@ -5023,7 +5024,7 @@
Handle<String>* error,
bool multiline,
Zone* zone)
- : isolate_(Isolate::Current()),
+ : isolate_(zone->isolate()),
zone_(zone),
error_(error),
captures_(NULL),
@@ -5895,9 +5896,9 @@
// Create a Scanner for the preparser to use as input, and preparse the
source.
-ScriptDataImpl* PreParserApi::PreParse(Utf16CharacterStream* source) {
+ScriptDataImpl* PreParserApi::PreParse(Isolate* isolate,
+ Utf16CharacterStream* source) {
CompleteParserRecorder recorder;
- Isolate* isolate = Isolate::Current();
HistogramTimerScope timer(isolate->counters()->pre_parse());
Scanner scanner(isolate->unicode_cache());
intptr_t stack_limit = isolate->stack_guard()->real_climit();
=======================================
--- /branches/bleeding_edge/src/parser.h Fri Aug 23 09:25:37 2013 UTC
+++ /branches/bleeding_edge/src/parser.h Wed Sep 4 07:05:11 2013 UTC
@@ -170,7 +170,8 @@
// This interface is here instead of in preparser.h because it
instantiates a
// preparser recorder object that is suited to the parser's purposes.
Also,
// the preparser doesn't know about ScriptDataImpl.
- static ScriptDataImpl* PreParse(Utf16CharacterStream* source);
+ static ScriptDataImpl* PreParse(Isolate* isolate,
+ Utf16CharacterStream* source);
};
@@ -894,7 +895,7 @@
static bool IsCompileTimeValue(Expression* expression);
// Get the value as a compile time value.
- static Handle<FixedArray> GetValue(Expression* expression);
+ static Handle<FixedArray> GetValue(Isolate* isolate, Expression*
expression);
// Get the type of a compile time value returned by GetValue().
static LiteralType GetLiteralType(Handle<FixedArray> value);
=======================================
--- /branches/bleeding_edge/src/runtime.cc Tue Sep 3 08:49:44 2013 UTC
+++ /branches/bleeding_edge/src/runtime.cc Wed Sep 4 07:05:11 2013 UTC
@@ -4774,10 +4774,10 @@
}
if (object->IsString() || object->IsNumber() || object->IsBoolean()) {
- return object->GetPrototype(isolate)->GetElement(index);
+ return object->GetPrototype(isolate)->GetElement(isolate, index);
}
- return object->GetElement(index);
+ return object->GetElement(isolate, index);
}
@@ -5904,7 +5904,7 @@
if (index < n) {
return frame->GetParameter(index);
} else {
- return isolate->initial_object_prototype()->GetElement(index);
+ return isolate->initial_object_prototype()->GetElement(isolate,
index);
}
}
@@ -6679,7 +6679,7 @@
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(String, value, 0);
- return value->ToObject();
+ return value->ToObject(isolate);
}
@@ -7528,7 +7528,7 @@
result = (r < 0) ? Smi::FromInt(LESS) : Smi::FromInt(GREATER);
}
ASSERT(result ==
- StringCharacterStreamCompare(Isolate::Current()->runtime_state(), x,
y));
+ StringCharacterStreamCompare(x->GetIsolate()->runtime_state(), x,
y));
return result;
}
@@ -8771,7 +8771,7 @@
}
for (int i = 0; i < argc; ++i) {
- argv[i] = Object::GetElement(arguments, offset + i);
+ argv[i] = Object::GetElement(isolate, arguments, offset + i);
}
bool threw;
@@ -8844,7 +8844,7 @@
extension_object = JSReceiver::cast(args[0]);
} else {
// Convert the object to a proper JavaScript object.
- MaybeObject* maybe_js_object = args[0]->ToObject();
+ MaybeObject* maybe_js_object = args[0]->ToObject(isolate);
if (!maybe_js_object->To(&extension_object)) {
if (Failure::cast(maybe_js_object)->IsInternalError()) {
HandleScope scope(isolate);
@@ -10158,7 +10158,7 @@
} else if (receiver->HasElement(j)) {
// Call GetElement on receiver, not its prototype, or getters
won't
// have the correct receiver.
- element_value = Object::GetElement(receiver, j);
+ element_value = Object::GetElement(isolate, receiver, j);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, element_value, false);
visitor->visit(j, element_value);
}
@@ -10183,7 +10183,8 @@
} else if (receiver->HasElement(j)) {
// Call GetElement on receiver, not its prototype, or getters
won't
// have the correct receiver.
- Handle<Object> element_value = Object::GetElement(receiver, j);
+ Handle<Object> element_value =
+ Object::GetElement(isolate, receiver, j);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, element_value, false);
visitor->visit(j, element_value);
}
@@ -10202,7 +10203,7 @@
while (j < n) {
HandleScope loop_scope(isolate);
uint32_t index = indices[j];
- Handle<Object> element = Object::GetElement(receiver, index);
+ Handle<Object> element = Object::GetElement(isolate, receiver,
index);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, element, false);
visitor->visit(index, element);
// Skip to next different index (i.e., omit duplicates).
@@ -13590,7 +13591,7 @@
Handle<Name> base =
isolate->factory()->NewStringFromAscii(CStrVector("base"));
for (unsigned int i = 0; i < length; ++i) {
- MaybeObject* maybe_string = input->GetElement(i);
+ MaybeObject* maybe_string = input->GetElement(isolate, i);
Object* locale_id;
if (!maybe_string->ToObject(&locale_id) || !locale_id->IsString()) {
return isolate->Throw(isolate->heap()->illegal_argument_string());
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Tue Sep 3 08:55:52
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-api.cc Wed Sep 4 07:05:11
2013 UTC
@@ -15006,10 +15006,19 @@
CHECK_EQ(42, CompileRun("f(this).foo")->Int32Value());
}
+static void CheckElementValue(i::Isolate* isolate,
+ int expected,
+ i::Handle<i::Object> obj,
+ int offset) {
+ i::Object* element = obj->GetElement(isolate, offset)->ToObjectChecked();
+ CHECK_EQ(expected, i::Smi::cast(element)->value());
+}
+
THREADED_TEST(PixelArray) {
LocalContext context;
- i::Factory* factory = i::Isolate::Current()->factory();
+ i::Isolate* isolate = i::Isolate::Current();
+ i::Factory* factory = isolate->factory();
v8::HandleScope scope(context->GetIsolate());
const int kElementCount = 260;
uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
@@ -15035,7 +15044,7 @@
// Set the elements to be the pixels.
// jsobj->set_elements(*pixels);
obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount);
- CHECK_EQ(1,
i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 1, jsobj, 1);
obj->Set(v8_str("field"), v8::Int32::New(1503));
context->Global()->Set(v8_str("pixels"), obj);
v8::Handle<v8::Value> result = CompileRun("pixels.field");
@@ -15092,40 +15101,33 @@
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
ASSERT(!no_failure.is_null());
i::USE(no_failure);
- CHECK_EQ(2,
i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 2, jsobj, 1);
*value.location() = i::Smi::FromInt(256);
no_failure =
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
ASSERT(!no_failure.is_null());
i::USE(no_failure);
- CHECK_EQ(255,
- i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 255, jsobj, 1);
*value.location() = i::Smi::FromInt(-1);
no_failure =
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
ASSERT(!no_failure.is_null());
i::USE(no_failure);
- CHECK_EQ(0,
i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 0, jsobj, 1);
result = CompileRun("for (var i = 0; i < 8; i++) {"
" pixels[i] = (i * 65) - 109;"
"}"
"pixels[1] + pixels[6];");
CHECK_EQ(255, result->Int32Value());
- CHECK_EQ(0,
i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value());
- CHECK_EQ(0,
i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
- CHECK_EQ(21,
- i::Smi::cast(jsobj->GetElement(2)->ToObjectChecked())->value());
- CHECK_EQ(86,
- i::Smi::cast(jsobj->GetElement(3)->ToObjectChecked())->value());
- CHECK_EQ(151,
- i::Smi::cast(jsobj->GetElement(4)->ToObjectChecked())->value());
- CHECK_EQ(216,
- i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value());
- CHECK_EQ(255,
- i::Smi::cast(jsobj->GetElement(6)->ToObjectChecked())->value());
- CHECK_EQ(255,
- i::Smi::cast(jsobj->GetElement(7)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 0, jsobj, 0);
+ CheckElementValue(isolate, 0, jsobj, 1);
+ CheckElementValue(isolate, 21, jsobj, 2);
+ CheckElementValue(isolate, 86, jsobj, 3);
+ CheckElementValue(isolate, 151, jsobj, 4);
+ CheckElementValue(isolate, 216, jsobj, 5);
+ CheckElementValue(isolate, 255, jsobj, 6);
+ CheckElementValue(isolate, 255, jsobj, 7);
result = CompileRun("var sum = 0;"
"for (var i = 0; i < 8; i++) {"
" sum += pixels[i];"
@@ -15138,50 +15140,49 @@
"}"
"pixels[1] + pixels[6];");
CHECK_EQ(8, result->Int32Value());
- CHECK_EQ(0,
i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value());
- CHECK_EQ(1,
i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
- CHECK_EQ(2,
i::Smi::cast(jsobj->GetElement(2)->ToObjectChecked())->value());
- CHECK_EQ(3,
i::Smi::cast(jsobj->GetElement(3)->ToObjectChecked())->value());
- CHECK_EQ(4,
i::Smi::cast(jsobj->GetElement(4)->ToObjectChecked())->value());
- CHECK_EQ(6,
i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value());
- CHECK_EQ(7,
i::Smi::cast(jsobj->GetElement(6)->ToObjectChecked())->value());
- CHECK_EQ(8,
i::Smi::cast(jsobj->GetElement(7)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 0, jsobj, 0);
+ CheckElementValue(isolate, 1, jsobj, 1);
+ CheckElementValue(isolate, 2, jsobj, 2);
+ CheckElementValue(isolate, 3, jsobj, 3);
+ CheckElementValue(isolate, 4, jsobj, 4);
+ CheckElementValue(isolate, 6, jsobj, 5);
+ CheckElementValue(isolate, 7, jsobj, 6);
+ CheckElementValue(isolate, 8, jsobj, 7);
result = CompileRun("for (var i = 0; i < 8; i++) {"
" pixels[7] = undefined;"
"}"
"pixels[7];");
CHECK_EQ(0, result->Int32Value());
- CHECK_EQ(0,
i::Smi::cast(jsobj->GetElement(7)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 0, jsobj, 7);
result = CompileRun("for (var i = 0; i < 8; i++) {"
" pixels[6] = '2.3';"
"}"
"pixels[6];");
CHECK_EQ(2, result->Int32Value());
- CHECK_EQ(2,
i::Smi::cast(jsobj->GetElement(6)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 2, jsobj, 6);
result = CompileRun("for (var i = 0; i < 8; i++) {"
" pixels[5] = NaN;"
"}"
"pixels[5];");
CHECK_EQ(0, result->Int32Value());
- CHECK_EQ(0,
i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 0, jsobj, 5);
result = CompileRun("for (var i = 0; i < 8; i++) {"
" pixels[8] = Infinity;"
"}"
"pixels[8];");
CHECK_EQ(255, result->Int32Value());
- CHECK_EQ(255,
- i::Smi::cast(jsobj->GetElement(8)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 255, jsobj, 8);
result = CompileRun("for (var i = 0; i < 8; i++) {"
" pixels[9] = -Infinity;"
"}"
"pixels[9];");
CHECK_EQ(0, result->Int32Value());
- CHECK_EQ(0,
i::Smi::cast(jsobj->GetElement(9)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 0, jsobj, 9);
result = CompileRun("pixels[3] = 33;"
"delete pixels[3];"
@@ -15498,6 +15499,7 @@
v8::ExternalArrayType array_type,
int64_t low, int64_t high) {
i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
+ i::Isolate* isolate = jsobj->GetIsolate();
obj->Set(v8_str("field"), v8::Int32::New(1503));
context->Global()->Set(v8_str("ext_array"), obj);
v8::Handle<v8::Value> result = CompileRun("ext_array.field");
@@ -15639,12 +15641,11 @@
CHECK_EQ(0, result->Int32Value());
if (array_type == v8::kExternalDoubleArray ||
array_type == v8::kExternalFloatArray) {
- CHECK_EQ(
- static_cast<int>(i::OS::nan_value()),
-
static_cast<int>(jsobj->GetElement(7)->ToObjectChecked()->Number()));
+ CHECK_EQ(static_cast<int>(i::OS::nan_value()),
+ static_cast<int>(
+ jsobj->GetElement(isolate,
7)->ToObjectChecked()->Number()));
} else {
- CHECK_EQ(0, static_cast<int>(
- jsobj->GetElement(7)->ToObjectChecked()->Number()));
+ CheckElementValue(isolate, 0, jsobj, 7);
}
result = CompileRun("for (var i = 0; i < 8; i++) {"
@@ -15652,8 +15653,9 @@
"}"
"ext_array[6];");
CHECK_EQ(2, result->Int32Value());
- CHECK_EQ(
- 2,
static_cast<int>(jsobj->GetElement(6)->ToObjectChecked()->Number()));
+ CHECK_EQ(2,
+ static_cast<int>(
+ jsobj->GetElement(isolate,
6)->ToObjectChecked()->Number()));
if (array_type != v8::kExternalFloatArray &&
array_type != v8::kExternalDoubleArray) {
@@ -15667,8 +15669,7 @@
"}"
"ext_array[5];");
CHECK_EQ(0, result->Int32Value());
- CHECK_EQ(0,
-
i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 0, jsobj, 5);
result = CompileRun("for (var i = 0; i < 8; i++) {"
" ext_array[i] = 5;"
@@ -15680,8 +15681,7 @@
int expected_value =
(array_type == v8::kExternalPixelArray) ? 255 : 0;
CHECK_EQ(expected_value, result->Int32Value());
- CHECK_EQ(expected_value,
-
i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value());
+ CheckElementValue(isolate, expected_value, jsobj, 5);
result = CompileRun("for (var i = 0; i < 8; i++) {"
" ext_array[i] = 5;"
@@ -15691,8 +15691,7 @@
"}"
"ext_array[5];");
CHECK_EQ(0, result->Int32Value());
- CHECK_EQ(0,
-
i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value());
+ CheckElementValue(isolate, 0, jsobj, 5);
// Check truncation behavior of integral arrays.
const char* unsigned_data =
@@ -15798,7 +15797,8 @@
int64_t low,
int64_t high) {
LocalContext context;
- i::Factory* factory = i::Isolate::Current()->factory();
+ i::Isolate* isolate = i::Isolate::Current();
+ i::Factory* factory = isolate->factory();
v8::HandleScope scope(context->GetIsolate());
const int kElementCount = 40;
int element_size = ExternalArrayElementSize(array_type);
@@ -15826,8 +15826,9 @@
obj->SetIndexedPropertiesToExternalArrayData(array_data,
array_type,
kElementCount);
- CHECK_EQ(
- 1,
static_cast<int>(jsobj->GetElement(1)->ToObjectChecked()->Number()));
+ CHECK_EQ(1,
+ static_cast<int>(
+ jsobj->GetElement(isolate,
1)->ToObjectChecked()->Number()));
ObjectWithExternalArrayTestHelper<ExternalArrayClass, ElementType>(
context.local(), obj, kElementCount, array_type, low, high);
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Tue Sep 3 08:49:44
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-heap.cc Wed Sep 4 07:05:11
2013 UTC
@@ -768,7 +768,7 @@
// array[length] = name.
array->SetElement(0, *name, NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(1), array->length());
- CHECK_EQ(array->GetElement(0), *name);
+ CHECK_EQ(array->GetElement(isolate, 0), *name);
// Set array length with larger than smi value.
Handle<Object> length =
@@ -785,8 +785,8 @@
uint32_t new_int_length = 0;
CHECK(array->length()->ToArrayIndex(&new_int_length));
CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
- CHECK_EQ(array->GetElement(int_length), *name);
- CHECK_EQ(array->GetElement(0), *name);
+ CHECK_EQ(array->GetElement(isolate, int_length), *name);
+ CHECK_EQ(array->GetElement(isolate, 0), *name);
}
@@ -817,8 +817,8 @@
Handle<JSObject> clone = Copy(obj);
CHECK(!clone.is_identical_to(obj));
- CHECK_EQ(obj->GetElement(0), clone->GetElement(0));
- CHECK_EQ(obj->GetElement(1), clone->GetElement(1));
+ CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 0));
+ CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 1));
CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*first));
CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
@@ -832,8 +832,8 @@
clone->SetElement(0, *second, NONE, kNonStrictMode)->ToObjectChecked();
clone->SetElement(1, *first, NONE, kNonStrictMode)->ToObjectChecked();
- CHECK_EQ(obj->GetElement(1), clone->GetElement(0));
- CHECK_EQ(obj->GetElement(0), clone->GetElement(1));
+ CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 0));
+ CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 1));
CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*first));
CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*second));
=======================================
--- /branches/bleeding_edge/test/cctest/test-parsing.cc Fri Aug 23 11:10:03
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-parsing.cc Wed Sep 4 07:05:11
2013 UTC
@@ -313,9 +313,10 @@
TEST(RegressChromium62639) {
v8::V8::Initialize();
+ i::Isolate* isolate = i::Isolate::Current();
int marker;
- i::Isolate::Current()->stack_guard()->SetStackLimit(
+ isolate->stack_guard()->SetStackLimit(
reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
const char* program = "var x = 'something';\n"
@@ -328,7 +329,7 @@
i::Utf8ToUtf16CharacterStream stream(
reinterpret_cast<const i::byte*>(program),
static_cast<unsigned>(strlen(program)));
- i::ScriptDataImpl* data = i::PreParserApi::PreParse(&stream);
+ i::ScriptDataImpl* data = i::PreParserApi::PreParse(isolate, &stream);
CHECK(data->HasError());
delete data;
}
@@ -355,7 +356,7 @@
i::Handle<i::String> source(
factory->NewStringFromAscii(i::CStrVector(program)));
i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
- i::ScriptDataImpl* data = i::PreParserApi::PreParse(&stream);
+ i::ScriptDataImpl* data = i::PreParserApi::PreParse(isolate, &stream);
CHECK(!data->HasError());
data->Initialize();
--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.