Commit 50ef25e0 authored by lrn@chromium.org's avatar lrn@chromium.org

Remove redundant allow-natives flag from CompilationInfo.

Just use script being native and FLAG_allow_natives_syntax directly.

Review URL: http://codereview.chromium.org/8314018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9643 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent eb8f4c64
...@@ -516,9 +516,6 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source, ...@@ -516,9 +516,6 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
info.MarkAsGlobal(); info.MarkAsGlobal();
info.SetExtension(extension); info.SetExtension(extension);
info.SetPreParseData(pre_data); info.SetPreParseData(pre_data);
if (natives == NATIVES_CODE) {
info.MarkAsAllowingNativesSyntax();
}
result = MakeFunctionInfo(&info); result = MakeFunctionInfo(&info);
if (extension == NULL && !result.is_null()) { if (extension == NULL && !result.is_null()) {
compilation_cache->PutScript(source, result); compilation_cache->PutScript(source, result);
......
...@@ -83,12 +83,6 @@ class CompilationInfo BASE_EMBEDDED { ...@@ -83,12 +83,6 @@ class CompilationInfo BASE_EMBEDDED {
ASSERT(is_lazy()); ASSERT(is_lazy());
flags_ |= IsInLoop::encode(true); flags_ |= IsInLoop::encode(true);
} }
void MarkAsAllowingNativesSyntax() {
flags_ |= IsNativesSyntaxAllowed::encode(true);
}
bool allows_natives_syntax() const {
return IsNativesSyntaxAllowed::decode(flags_);
}
void MarkAsNative() { void MarkAsNative() {
flags_ |= IsNative::encode(true); flags_ |= IsNative::encode(true);
} }
...@@ -199,8 +193,6 @@ class CompilationInfo BASE_EMBEDDED { ...@@ -199,8 +193,6 @@ class CompilationInfo BASE_EMBEDDED {
class IsInLoop: public BitField<bool, 3, 1> {}; class IsInLoop: public BitField<bool, 3, 1> {};
// Strict mode - used in eager compilation. // Strict mode - used in eager compilation.
class IsStrictMode: public BitField<bool, 4, 1> {}; class IsStrictMode: public BitField<bool, 4, 1> {};
// Native syntax (%-stuff) allowed?
class IsNativesSyntaxAllowed: public BitField<bool, 5, 1> {};
// Is this a function from our natives. // Is this a function from our natives.
class IsNative: public BitField<bool, 6, 1> {}; class IsNative: public BitField<bool, 6, 1> {};
......
...@@ -5196,13 +5196,16 @@ bool ParserApi::Parse(CompilationInfo* info) { ...@@ -5196,13 +5196,16 @@ bool ParserApi::Parse(CompilationInfo* info) {
Handle<Script> script = info->script(); Handle<Script> script = info->script();
bool harmony_scoping = !info->is_native() && FLAG_harmony_scoping; bool harmony_scoping = !info->is_native() && FLAG_harmony_scoping;
if (info->is_lazy()) { 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);
parser.SetHarmonyScoping(harmony_scoping); parser.SetHarmonyScoping(harmony_scoping);
result = parser.ParseLazy(info); result = parser.ParseLazy(info);
} else { } else {
// Whether we allow %identifier(..) syntax. // Whether we allow %identifier(..) syntax.
bool allow_natives_syntax = bool allow_natives_syntax =
info->allows_natives_syntax() || FLAG_allow_natives_syntax; info->is_native() || FLAG_allow_natives_syntax;
ScriptDataImpl* pre_data = info->pre_parse_data(); ScriptDataImpl* pre_data = info->pre_parse_data();
Parser parser(script, Parser parser(script,
allow_natives_syntax, allow_natives_syntax,
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Flags: --allow-natives-syntax
// Optimized variable access inside through a catch context should work. // Optimized variable access inside through a catch context should work.
function test(x) { function test(x) {
...@@ -44,4 +46,3 @@ function test(x) { ...@@ -44,4 +46,3 @@ function test(x) {
} }
test(3); test(3);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment