| OLD | NEW | 
|---|
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 //     * Redistributions of source code must retain the above copyright | 6 //     * Redistributions of source code must retain the above copyright | 
| 7 //       notice, this list of conditions and the following disclaimer. | 7 //       notice, this list of conditions and the following disclaimer. | 
| 8 //     * Redistributions in binary form must reproduce the above | 8 //     * Redistributions in binary form must reproduce the above | 
| 9 //       copyright notice, this list of conditions and the following | 9 //       copyright notice, this list of conditions and the following | 
| 10 //       disclaimer in the documentation and/or other materials provided | 10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 136 | 136 | 
| 137 void DeclarationContext::Check(const char* source, | 137 void DeclarationContext::Check(const char* source, | 
| 138                                int get, int set, int query, | 138                                int get, int set, int query, | 
| 139                                Expectations expectations, | 139                                Expectations expectations, | 
| 140                                v8::Handle<Value> value) { | 140                                v8::Handle<Value> value) { | 
| 141   InitializeIfNeeded(); | 141   InitializeIfNeeded(); | 
| 142   // A retry after a GC may pollute the counts, so perform gc now | 142   // A retry after a GC may pollute the counts, so perform gc now | 
| 143   // to avoid that. | 143   // to avoid that. | 
| 144   CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); | 144   CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); | 
| 145   HandleScope scope(CcTest::isolate()); | 145   HandleScope scope(CcTest::isolate()); | 
| 146   TryCatch catcher; | 146   TryCatch catcher(CcTest::isolate()); | 
| 147   catcher.SetVerbose(true); | 147   catcher.SetVerbose(true); | 
| 148   Local<Script> script = | 148   Local<Script> script = | 
| 149       Script::Compile(String::NewFromUtf8(CcTest::isolate(), source)); | 149       Script::Compile(String::NewFromUtf8(CcTest::isolate(), source)); | 
| 150   if (expectations == EXPECT_ERROR) { | 150   if (expectations == EXPECT_ERROR) { | 
| 151     CHECK(script.IsEmpty()); | 151     CHECK(script.IsEmpty()); | 
| 152     return; | 152     return; | 
| 153   } | 153   } | 
| 154   CHECK(!script.IsEmpty()); | 154   CHECK(!script.IsEmpty()); | 
| 155   Local<Value> result = script->Run(); | 155   Local<Value> result = script->Run(); | 
| 156   CHECK_EQ(get, get_count()); | 156   CHECK_EQ(get, get_count()); | 
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 560   } | 560   } | 
| 561 | 561 | 
| 562   ~SimpleContext() { | 562   ~SimpleContext() { | 
| 563     context_->Exit(); | 563     context_->Exit(); | 
| 564   } | 564   } | 
| 565 | 565 | 
| 566   void Check(const char* source, | 566   void Check(const char* source, | 
| 567              Expectations expectations, | 567              Expectations expectations, | 
| 568              v8::Handle<Value> value = Local<Value>()) { | 568              v8::Handle<Value> value = Local<Value>()) { | 
| 569     HandleScope scope(context_->GetIsolate()); | 569     HandleScope scope(context_->GetIsolate()); | 
| 570     TryCatch catcher; | 570     TryCatch catcher(context_->GetIsolate()); | 
| 571     catcher.SetVerbose(true); | 571     catcher.SetVerbose(true); | 
| 572     Local<Script> script = | 572     Local<Script> script = | 
| 573         Script::Compile(String::NewFromUtf8(context_->GetIsolate(), source)); | 573         Script::Compile(String::NewFromUtf8(context_->GetIsolate(), source)); | 
| 574     if (expectations == EXPECT_ERROR) { | 574     if (expectations == EXPECT_ERROR) { | 
| 575       CHECK(script.IsEmpty()); | 575       CHECK(script.IsEmpty()); | 
| 576       return; | 576       return; | 
| 577     } | 577     } | 
| 578     CHECK(!script.IsEmpty()); | 578     CHECK(!script.IsEmpty()); | 
| 579     Local<Value> result = script->Run(); | 579     Local<Value> result = script->Run(); | 
| 580     if (expectations == EXPECT_RESULT) { | 580     if (expectations == EXPECT_RESULT) { | 
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1241                   Undefined(CcTest::isolate())); | 1241                   Undefined(CcTest::isolate())); | 
| 1242     for (int i = 0; i < 4; i++) { | 1242     for (int i = 0; i < 4; i++) { | 
| 1243       context.Check("f()", EXPECT_EXCEPTION); | 1243       context.Check("f()", EXPECT_EXCEPTION); | 
| 1244     } | 1244     } | 
| 1245     context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, | 1245     context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, | 
| 1246                   Undefined(CcTest::isolate())); | 1246                   Undefined(CcTest::isolate())); | 
| 1247 | 1247 | 
| 1248     context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); | 1248     context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); | 
| 1249   } | 1249   } | 
| 1250 } | 1250 } | 
| OLD | NEW | 
|---|