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

Unified Diff: src/runtime/runtime-object.cc

Issue 2237983004: Merged: Squashed multiple commits. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.3
Patch Set: Created 4 years, 4 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/runtime/runtime.h ('k') | test/cctest/test-api-interceptors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 761008aa63d69504a66a0db284b6561135fbae8f..c7f23989eb9e4aba90b30ed51e210d457c6ee608 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -15,9 +15,10 @@
namespace v8 {
namespace internal {
-MaybeHandle<Object> Runtime::GetObjectProperty(
- Isolate* isolate, Handle<Object> object, Handle<Object> key,
- bool should_throw_reference_error) {
+MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate,
+ Handle<Object> object,
+ Handle<Object> key,
+ bool* is_found_out) {
if (object->IsUndefined(isolate) || object->IsNull(isolate)) {
THROW_NEW_ERROR(
isolate,
@@ -31,10 +32,7 @@ MaybeHandle<Object> Runtime::GetObjectProperty(
if (!success) return MaybeHandle<Object>();
MaybeHandle<Object> result = Object::GetProperty(&it);
- if (!result.is_null() && should_throw_reference_error && !it.IsFound()) {
- THROW_NEW_ERROR(
- isolate, NewReferenceError(MessageTemplate::kNotDefined, key), Object);
- }
+ if (is_found_out) *is_found_out = it.IsFound();
return result;
}
@@ -348,60 +346,6 @@ RUNTIME_FUNCTION(Runtime_GetProperty) {
Runtime::GetObjectProperty(isolate, object, key));
}
-namespace {
-
-Object* GetGlobal(Isolate* isolate, int slot, Handle<TypeFeedbackVector> vector,
- bool should_throw_reference_error) {
- FeedbackVectorSlot vector_slot = vector->ToSlot(slot);
- DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
- vector->GetKind(vector_slot));
- Handle<String> name(vector->GetName(vector_slot), isolate);
- DCHECK_NE(*name, *isolate->factory()->empty_string());
-
- Handle<JSGlobalObject> global = isolate->global_object();
-
- Handle<ScriptContextTable> script_contexts(
- global->native_context()->script_context_table());
-
- ScriptContextTable::LookupResult lookup_result;
- if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) {
- Handle<Context> script_context = ScriptContextTable::GetContext(
- script_contexts, lookup_result.context_index);
- Handle<Object> result =
- FixedArray::get(*script_context, lookup_result.slot_index, isolate);
- if (*result == *isolate->factory()->the_hole_value()) {
- THROW_NEW_ERROR_RETURN_FAILURE(
- isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
- }
- return *result;
- }
-
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- Runtime::GetObjectProperty(isolate, global, name,
- should_throw_reference_error));
- return *result;
-}
-
-} // namespace
-
-RUNTIME_FUNCTION(Runtime_GetGlobalInsideTypeof) {
- HandleScope scope(isolate);
- DCHECK_EQ(2, args.length());
- CONVERT_SMI_ARG_CHECKED(slot, 0);
- CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
- return GetGlobal(isolate, slot, vector, false);
-}
-
-RUNTIME_FUNCTION(Runtime_GetGlobalNotInsideTypeof) {
- HandleScope scope(isolate);
- DCHECK_EQ(2, args.length());
- CONVERT_SMI_ARG_CHECKED(slot, 0);
- CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
- return GetGlobal(isolate, slot, vector, true);
-}
-
// KeyedGetProperty is called from KeyedLoadIC::GenerateGeneric.
RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
HandleScope scope(isolate);
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-api-interceptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698