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

Unified Diff: src/contexts.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 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/contexts.h ('k') | src/cpu-profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index 58b95425d20c58b09ba2478ca45181f091f055db..2698342397ba503144095a4ee35be4f0043e0507 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -240,6 +240,69 @@ bool Context::GlobalIfNotShadowedByEval(Handle<String> name) {
}
+void Context::AddOptimizedFunction(JSFunction* function) {
+ ASSERT(IsGlobalContext());
+#ifdef DEBUG
+ Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
+ while (!element->IsUndefined()) {
+ CHECK(element != function);
+ element = JSFunction::cast(element)->next_function_link();
+ }
+
+ CHECK(function->next_function_link()->IsUndefined());
+
+ // Check that the context belongs to the weak global contexts list.
+ bool found = false;
+ Object* context = GetHeap()->global_contexts_list();
+ while (!context->IsUndefined()) {
+ if (context == this) {
+ found = true;
+ break;
+ }
+ context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
+ }
+ CHECK(found);
+#endif
+ function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST));
+ set(OPTIMIZED_FUNCTIONS_LIST, function);
+}
+
+
+void Context::RemoveOptimizedFunction(JSFunction* function) {
+ ASSERT(IsGlobalContext());
+ Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
+ JSFunction* prev = NULL;
+ while (!element->IsUndefined()) {
+ JSFunction* element_function = JSFunction::cast(element);
+ ASSERT(element_function->next_function_link()->IsUndefined() ||
+ element_function->next_function_link()->IsJSFunction());
+ if (element_function == function) {
+ if (prev == NULL) {
+ set(OPTIMIZED_FUNCTIONS_LIST, element_function->next_function_link());
+ } else {
+ prev->set_next_function_link(element_function->next_function_link());
+ }
+ element_function->set_next_function_link(GetHeap()->undefined_value());
+ return;
+ }
+ prev = element_function;
+ element = element_function->next_function_link();
+ }
+ UNREACHABLE();
+}
+
+
+Object* Context::OptimizedFunctionsListHead() {
+ ASSERT(IsGlobalContext());
+ return get(OPTIMIZED_FUNCTIONS_LIST);
+}
+
+
+void Context::ClearOptimizedFunctions() {
+ set(OPTIMIZED_FUNCTIONS_LIST, GetHeap()->undefined_value());
+}
+
+
#ifdef DEBUG
bool Context::IsBootstrappingOrContext(Object* object) {
// During bootstrapping we allow all objects to pass as
« no previous file with comments | « src/contexts.h ('k') | src/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698