Index: src/builtins.cc |
=================================================================== |
--- src/builtins.cc (revision 11005) |
+++ src/builtins.cc (working copy) |
@@ -1570,30 +1570,30 @@ |
BuiltinExtraArguments extra_args; |
}; |
+#define BUILTIN_FUNCTION_TABLE_INIT { V8_ONCE_INIT, {} } |
+ |
class BuiltinFunctionTable { |
public: |
- BuiltinFunctionTable() { |
- Builtins::InitBuiltinFunctionTable(); |
+ BuiltinDesc* functions() { |
+ CallOnce(&once_, &Builtins::InitBuiltinFunctionTable); |
+ return functions_; |
} |
- static const BuiltinDesc* functions() { return functions_; } |
+ OnceType once_; |
+ BuiltinDesc functions_[Builtins::builtin_count + 1]; |
- private: |
- static BuiltinDesc functions_[Builtins::builtin_count + 1]; |
- |
friend class Builtins; |
}; |
-BuiltinDesc BuiltinFunctionTable::functions_[Builtins::builtin_count + 1]; |
+static BuiltinFunctionTable builtin_function_table = |
+ BUILTIN_FUNCTION_TABLE_INIT; |
-static const BuiltinFunctionTable builtin_function_table_init; |
- |
// Define array of pointers to generators and C builtin functions. |
// We do this in a sort of roundabout way so that we can do the initialization |
// within the lexical scope of Builtins:: and within a context where |
// Code::Flags names a non-abstract type. |
void Builtins::InitBuiltinFunctionTable() { |
- BuiltinDesc* functions = BuiltinFunctionTable::functions_; |
+ BuiltinDesc* functions = builtin_function_table.functions_; |
functions[builtin_count].generator = NULL; |
functions[builtin_count].c_code = NULL; |
functions[builtin_count].s_name = NULL; |
@@ -1637,7 +1637,7 @@ |
// Create a scope for the handles in the builtins. |
HandleScope scope(isolate); |
- const BuiltinDesc* functions = BuiltinFunctionTable::functions(); |
+ const BuiltinDesc* functions = builtin_function_table.functions(); |
// For now we generate builtin adaptor code into a stack-allocated |
// buffer, before copying it into individual code objects. Be careful |