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

Side by Side Diff: src/isolate.cc

Issue 29053002: Provide a mechanism for the embedder to set a TotalPhysicalMemory callback function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« src/api.cc ('K') | « src/isolate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 simulator_ = NULL; 95 simulator_ = NULL;
96 #endif 96 #endif
97 js_entry_sp_ = NULL; 97 js_entry_sp_ = NULL;
98 external_callback_scope_ = NULL; 98 external_callback_scope_ = NULL;
99 current_vm_state_ = EXTERNAL; 99 current_vm_state_ = EXTERNAL;
100 try_catch_handler_address_ = NULL; 100 try_catch_handler_address_ = NULL;
101 context_ = NULL; 101 context_ = NULL;
102 thread_id_ = ThreadId::Invalid(); 102 thread_id_ = ThreadId::Invalid();
103 external_caught_exception_ = false; 103 external_caught_exception_ = false;
104 failed_access_check_callback_ = NULL; 104 failed_access_check_callback_ = NULL;
105 total_physical_memory_callback_ = NULL;
105 save_context_ = NULL; 106 save_context_ = NULL;
106 catcher_ = NULL; 107 catcher_ = NULL;
107 top_lookup_result_ = NULL; 108 top_lookup_result_ = NULL;
108 109
109 // These members are re-initialized later after deserialization 110 // These members are re-initialized later after deserialization
110 // is complete. 111 // is complete.
111 pending_exception_ = NULL; 112 pending_exception_ = NULL;
112 has_pending_message_ = false; 113 has_pending_message_ = false;
113 rethrowing_message_ = false; 114 rethrowing_message_ = false;
114 pending_message_obj_ = NULL; 115 pending_message_obj_ = NULL;
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 Handle<Object> data(AccessCheckInfo::cast(data_obj)->data(), this); 956 Handle<Object> data(AccessCheckInfo::cast(data_obj)->data(), this);
956 { VMState<EXTERNAL> state(this); 957 { VMState<EXTERNAL> state(this);
957 thread_local_top()->failed_access_check_callback_( 958 thread_local_top()->failed_access_check_callback_(
958 v8::Utils::ToLocal(receiver_handle), 959 v8::Utils::ToLocal(receiver_handle),
959 type, 960 type,
960 v8::Utils::ToLocal(data)); 961 v8::Utils::ToLocal(data));
961 } 962 }
962 } 963 }
963 964
964 965
966 void Isolate::SetTotalPhysicalMemoryCallback(
967 v8::TotalPhysicalMemoryCallback callback) {
968 thread_local_top()->total_physical_memory_callback_ = callback;
969 }
970
971
965 enum MayAccessDecision { 972 enum MayAccessDecision {
966 YES, NO, UNKNOWN 973 YES, NO, UNKNOWN
967 }; 974 };
968 975
969 976
970 static MayAccessDecision MayAccessPreCheck(Isolate* isolate, 977 static MayAccessDecision MayAccessPreCheck(Isolate* isolate,
971 JSObject* receiver, 978 JSObject* receiver,
972 v8::AccessType type) { 979 v8::AccessType type) {
973 // During bootstrapping, callback functions are not enabled yet. 980 // During bootstrapping, callback functions are not enabled yet.
974 if (isolate->bootstrapper()->IsActive()) return YES; 981 if (isolate->bootstrapper()->IsActive()) return YES;
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 2522
2516 #ifdef DEBUG 2523 #ifdef DEBUG
2517 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2524 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2518 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2525 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2519 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2526 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2520 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2527 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2521 #undef ISOLATE_FIELD_OFFSET 2528 #undef ISOLATE_FIELD_OFFSET
2522 #endif 2529 #endif
2523 2530
2524 } } // namespace v8::internal 2531 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698