Index: src/runtime.h |
=================================================================== |
--- src/runtime.h (revision 7267) |
+++ src/runtime.h (working copy) |
@@ -28,6 +28,8 @@ |
#ifndef V8_RUNTIME_H_ |
#define V8_RUNTIME_H_ |
+#include "zone.h" |
+ |
namespace v8 { |
namespace internal { |
@@ -412,7 +414,6 @@ |
#define RUNTIME_FUNCTION_LIST_DEBUG(F) |
#endif |
- |
// ---------------------------------------------------------------------------- |
// RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
// either directly by id (via the code generator), or indirectly |
@@ -482,6 +483,57 @@ |
//--------------------------------------------------------------------------- |
// Runtime provides access to all C++ runtime functions. |
+class RuntimeState { |
+ public: |
+ |
+ StaticResource<StringInputBuffer>* string_input_buffer() { |
+ return &string_input_buffer_; |
+ } |
+ unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { |
+ return &to_upper_mapping_; |
+ } |
+ unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { |
+ return &to_lower_mapping_; |
+ } |
+ StringInputBuffer* string_input_buffer_compare_bufx() { |
+ return &string_input_buffer_compare_bufx_; |
+ } |
+ StringInputBuffer* string_input_buffer_compare_bufy() { |
+ return &string_input_buffer_compare_bufy_; |
+ } |
+ StringInputBuffer* string_locale_compare_buf1() { |
+ return &string_locale_compare_buf1_; |
+ } |
+ StringInputBuffer* string_locale_compare_buf2() { |
+ return &string_locale_compare_buf2_; |
+ } |
+ int* smi_lexicographic_compare_x_elms() { |
+ return smi_lexicographic_compare_x_elms_; |
+ } |
+ int* smi_lexicographic_compare_y_elms() { |
+ return smi_lexicographic_compare_y_elms_; |
+ } |
+ |
+ private: |
+ RuntimeState() {} |
+ // Non-reentrant string buffer for efficient general use in the runtime. |
+ StaticResource<StringInputBuffer> string_input_buffer_; |
+ unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; |
+ unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; |
+ StringInputBuffer string_input_buffer_compare_bufx_; |
+ StringInputBuffer string_input_buffer_compare_bufy_; |
+ StringInputBuffer string_locale_compare_buf1_; |
+ StringInputBuffer string_locale_compare_buf2_; |
+ int smi_lexicographic_compare_x_elms_[10]; |
+ int smi_lexicographic_compare_y_elms_[10]; |
+ |
+ friend class Isolate; |
+ friend class Runtime; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
+}; |
+ |
+ |
class Runtime : public AllStatic { |
public: |
enum FunctionId { |
@@ -525,30 +577,35 @@ |
// retried with a new, empty StringDictionary, not with the same one. |
// Alternatively, heap initialization can be completely restarted. |
MUST_USE_RESULT static MaybeObject* InitializeIntrinsicFunctionNames( |
- Object* dictionary); |
+ Heap* heap, Object* dictionary); |
// Get the intrinsic function with the given name, which must be a symbol. |
- static Function* FunctionForSymbol(Handle<String> name); |
+ static const Function* FunctionForSymbol(Handle<String> name); |
// Get the intrinsic function with the given FunctionId. |
- static Function* FunctionForId(FunctionId id); |
+ static const Function* FunctionForId(FunctionId id); |
// General-purpose helper functions for runtime system. |
- static int StringMatch(Handle<String> sub, Handle<String> pat, int index); |
+ static int StringMatch(Isolate* isolate, |
+ Handle<String> sub, |
+ Handle<String> pat, |
+ int index); |
- static bool IsUpperCaseChar(uint16_t ch); |
+ static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch); |
// TODO(1240886): The following three methods are *not* handle safe, |
// but accept handle arguments. This seems fragile. |
// Support getting the characters in a string using [] notation as |
// in Firefox/SpiderMonkey, Safari and Opera. |
- MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Handle<Object> object, |
+ MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Isolate* isolate, |
+ Handle<Object> object, |
uint32_t index); |
MUST_USE_RESULT static MaybeObject* GetElement(Handle<Object> object, |
uint32_t index); |
MUST_USE_RESULT static MaybeObject* SetObjectProperty( |
+ Isolate* isolate, |
Handle<Object> object, |
Handle<Object> key, |
Handle<Object> value, |
@@ -556,27 +613,31 @@ |
StrictModeFlag strict_mode); |
MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty( |
+ Isolate* isolate, |
Handle<JSObject> object, |
Handle<Object> key, |
Handle<Object> value, |
PropertyAttributes attr); |
MUST_USE_RESULT static MaybeObject* ForceDeleteObjectProperty( |
+ Isolate* isolate, |
Handle<JSObject> object, |
Handle<Object> key); |
- MUST_USE_RESULT static MaybeObject* GetObjectProperty(Handle<Object> object, |
- Handle<Object> key); |
+ MUST_USE_RESULT static MaybeObject* GetObjectProperty( |
+ Isolate* isolate, |
+ Handle<Object> object, |
+ Handle<Object> key); |
// This function is used in FunctionNameUsing* tests. |
- static Object* FindSharedFunctionInfoInScript(Handle<Script> script, |
+ static Object* FindSharedFunctionInfoInScript(Isolate* isolate, |
+ Handle<Script> script, |
int position); |
// Helper functions used stubs. |
static void PerformGC(Object* result); |
}; |
- |
} } // namespace v8::internal |
#endif // V8_RUNTIME_H_ |