Reviewers: Rico,
Description:
Port r9643 to 3.1 branch.
Please review this at http://codereview.chromium.org/8460007/
SVN Base: https://v8.googlecode.com/svn/branches/3.1
Affected files:
M src/compiler.h
M src/parser.cc
M src/version.cc
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index
e0a437ac6de8419a777a631772a828796080f763..b5c20849ec07f14c5feb8e73e42162dde080ba41
100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -80,6 +80,12 @@ class CompilationInfo BASE_EMBEDDED {
ASSERT(is_lazy());
flags_ |= IsInLoop::encode(true);
}
+ void MarkAsNative() {
+ flags_ |= IsNative::encode(true);
+ }
+ bool is_native() const {
+ return IsNative::decode(flags_);
+ }
void SetFunction(FunctionLiteral* literal) {
ASSERT(function_ == NULL);
function_ = literal;
@@ -152,6 +158,9 @@ class CompilationInfo BASE_EMBEDDED {
void Initialize(Mode mode) {
mode_ = V8::UseCrankshaft() ? mode : NONOPT;
+ if (script_->type()->value() == Script::TYPE_NATIVE) {
+ MarkAsNative();
+ }
if (!shared_info_.is_null() && shared_info_->strict_mode()) {
MarkAsStrict();
}
@@ -174,6 +183,8 @@ class CompilationInfo BASE_EMBEDDED {
class IsInLoop: public BitField<bool, 3, 1> {};
// Strict mode - used in eager compilation.
class IsStrict: public BitField<bool, 4, 1> {};
+ // Is this a function from our natives.
+ class IsNative: public BitField<bool, 6, 1> {};
unsigned flags_;
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index
6d462bc53c576e0a6bb926b3fa3783b94645ea47..c56376a32a1de2ea10c29bf30944d0d03240543a
100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -5142,11 +5142,14 @@ bool ParserApi::Parse(CompilationInfo* info) {
FunctionLiteral* result = NULL;
Handle<Script> script = info->script();
if (info->is_lazy()) {
- Parser parser(script, true, NULL, NULL);
+ bool allow_natives_syntax =
+ FLAG_allow_natives_syntax ||
+ info->is_native();
+ Parser parser(script, allow_natives_syntax, NULL, NULL);
result = parser.ParseLazy(info);
} else {
bool allow_natives_syntax =
- FLAG_allow_natives_syntax || Bootstrapper::IsActive();
+ info->is_native() || 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()) {
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index
b7c59dcde400331b48b80b48582994a84d025ebf..a2120d11b936312df179c7d06b5a46e7a758a2e2
100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 1
#define BUILD_NUMBER 8
-#define PATCH_LEVEL 26
+#define PATCH_LEVEL 27
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev