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

Unified Diff: src/ic/ic.cc

Issue 2220203002: [ic] Merge LoadGlobalIC_Slow builtins for inside typeof and outside typeof cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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/ic/ic.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index d92d22df40eb71fb14c3fdd53b9645d6226a661e..62571612d72ed3a7c0075dc12662ba9c7814efe7 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -2313,6 +2313,54 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
return *result;
}
+RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_SMI_ARG_CHECKED(slot, 0);
+ CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
+
+ 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;
+ bool is_found = false;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ Runtime::GetObjectProperty(isolate, global, name, &is_found));
+ if (!is_found) {
+ LoadICNexus nexus(isolate);
+ LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
+ // It is actually a LoadGlobalICs here but the predicate handles this case
+ // properly.
+ if (ic.ShouldThrowReferenceError()) {
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
+ }
+ }
+ return *result;
+}
+
// Used from ic-<arch>.cc
RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
TimerEventScope<TimerEventIcMiss> timer(isolate);
« no previous file with comments | « src/ic/ic.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698