Revision: 7177
Author: [email protected]
Date: Tue Mar 15 07:26:55 2011
Log: Use NativesFlag to allow/disallow natives syntax during compilation.
This way we can avoid changing the value of FLAG_allow_natives_syntax.
Review URL: http://codereview.chromium.org/6694024
http://code.google.com/p/v8/source/detail?r=7177
Modified:
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/compiler.h
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/parser.cc
=======================================
--- /branches/bleeding_edge/src/compiler.cc Mon Mar 14 04:26:19 2011
+++ /branches/bleeding_edge/src/compiler.cc Tue Mar 15 07:26:55 2011
@@ -529,6 +529,7 @@
info.MarkAsGlobal();
info.SetExtension(extension);
info.SetPreParseData(pre_data);
+ if (natives == NATIVES_CODE) info.MarkAsAllowingNativesSyntax();
result = MakeFunctionInfo(&info);
if (extension == NULL && !result.is_null()) {
CompilationCache::PutScript(source, result);
=======================================
--- /branches/bleeding_edge/src/compiler.h Tue Feb 22 08:31:24 2011
+++ /branches/bleeding_edge/src/compiler.h Tue Mar 15 07:26:55 2011
@@ -80,6 +80,12 @@
ASSERT(is_lazy());
flags_ |= IsInLoop::encode(true);
}
+ void MarkAsAllowingNativesSyntax() {
+ flags_ |= IsNativesSyntaxAllowed::encode(true);
+ }
+ bool allows_natives_syntax() const {
+ return IsNativesSyntaxAllowed::decode(flags_);
+ }
void SetFunction(FunctionLiteral* literal) {
ASSERT(function_ == NULL);
function_ = literal;
@@ -174,6 +180,8 @@
class IsInLoop: public BitField<bool, 3, 1> {};
// Strict mode - used in eager compilation.
class IsStrict: public BitField<bool, 4, 1> {};
+ // Native syntax (%-stuff) allowed?
+ class IsNativesSyntaxAllowed: public BitField<bool, 5, 1> {};
unsigned flags_;
=======================================
--- /branches/bleeding_edge/src/debug.cc Tue Mar 8 03:14:25 2011
+++ /branches/bleeding_edge/src/debug.cc Tue Mar 15 07:26:55 2011
@@ -764,15 +764,12 @@
Handle<String> script_name = Factory::NewStringFromAscii(name);
// Compile the script.
- bool allow_natives_syntax = FLAG_allow_natives_syntax;
- FLAG_allow_natives_syntax = true;
Handle<SharedFunctionInfo> function_info;
function_info = Compiler::Compile(source_code,
script_name,
0, 0, NULL, NULL,
Handle<String>::null(),
NATIVES_CODE);
- FLAG_allow_natives_syntax = allow_natives_syntax;
// Silently ignore stack overflows during compilation.
if (function_info.is_null()) {
=======================================
--- /branches/bleeding_edge/src/parser.cc Wed Mar 9 08:57:03 2011
+++ /branches/bleeding_edge/src/parser.cc Tue Mar 15 07:26:55 2011
@@ -5133,7 +5133,7 @@
result = parser.ParseLazy(info);
} else {
bool allow_natives_syntax =
- FLAG_allow_natives_syntax || Bootstrapper::IsActive();
+ info->allows_natives_syntax() || FLAG_allow_natives_syntax;
ScriptDataImpl* pre_data = info->pre_parse_data();
Parser parser(script, allow_natives_syntax, info->extension(),
pre_data);
if (pre_data != NULL && pre_data->has_error()) {
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev