Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: test/cctest/test-api.cc

Issue 303463005: Extract build configuration into a separate header and move it to the base lib (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform/mutex.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 6652 matching lines...) Expand 10 before | Expand all | Expand 10 after
6663 "%OptimizeFunctionOnNextCall(testBool);" 6663 "%OptimizeFunctionOnNextCall(testBool);"
6664 "for (var i = 0; i < 10; i++) {" 6664 "for (var i = 0; i < 10; i++) {"
6665 " testBranch();" 6665 " testBranch();"
6666 " testBool();" 6666 " testBool();"
6667 "}\n" 6667 "}\n"
6668 "\"PASS\"", 6668 "\"PASS\"",
6669 "PASS"); 6669 "PASS");
6670 } 6670 }
6671 6671
6672 6672
6673 template <typename T> static void USE(T) { }
6674
6675
6676 // The point of this test is type checking. We run it only so compilers 6673 // The point of this test is type checking. We run it only so compilers
6677 // don't complain about an unused function. 6674 // don't complain about an unused function.
6678 TEST(PersistentHandles) { 6675 TEST(PersistentHandles) {
6679 LocalContext env; 6676 LocalContext env;
6680 v8::Isolate* isolate = CcTest::isolate(); 6677 v8::Isolate* isolate = CcTest::isolate();
6681 v8::HandleScope scope(isolate); 6678 v8::HandleScope scope(isolate);
6682 Local<String> str = v8_str("foo"); 6679 Local<String> str = v8_str("foo");
6683 v8::Persistent<String> p_str(isolate, str); 6680 v8::Persistent<String> p_str(isolate, str);
6684 p_str.Reset(); 6681 p_str.Reset();
6685 Local<Script> scr = v8_compile(""); 6682 Local<Script> scr = v8_compile("");
(...skipping 9138 matching lines...) Expand 10 before | Expand all | Expand 10 after
15824 "}" 15821 "}"
15825 "sum;"); 15822 "sum;");
15826 CHECK_EQ(28, result->Int32Value()); 15823 CHECK_EQ(28, result->Int32Value());
15827 15824
15828 i::Handle<i::Smi> value(i::Smi::FromInt(2), 15825 i::Handle<i::Smi> value(i::Smi::FromInt(2),
15829 reinterpret_cast<i::Isolate*>(context->GetIsolate())); 15826 reinterpret_cast<i::Isolate*>(context->GetIsolate()));
15830 i::Handle<i::Object> no_failure; 15827 i::Handle<i::Object> no_failure;
15831 no_failure = i::JSObject::SetElement( 15828 no_failure = i::JSObject::SetElement(
15832 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked(); 15829 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
15833 ASSERT(!no_failure.is_null()); 15830 ASSERT(!no_failure.is_null());
15834 i::USE(no_failure); 15831 USE(no_failure);
15835 CheckElementValue(isolate, 2, jsobj, 1); 15832 CheckElementValue(isolate, 2, jsobj, 1);
15836 *value.location() = i::Smi::FromInt(256); 15833 *value.location() = i::Smi::FromInt(256);
15837 no_failure = i::JSObject::SetElement( 15834 no_failure = i::JSObject::SetElement(
15838 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked(); 15835 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
15839 ASSERT(!no_failure.is_null()); 15836 ASSERT(!no_failure.is_null());
15840 i::USE(no_failure); 15837 USE(no_failure);
15841 CheckElementValue(isolate, 255, jsobj, 1); 15838 CheckElementValue(isolate, 255, jsobj, 1);
15842 *value.location() = i::Smi::FromInt(-1); 15839 *value.location() = i::Smi::FromInt(-1);
15843 no_failure = i::JSObject::SetElement( 15840 no_failure = i::JSObject::SetElement(
15844 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked(); 15841 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
15845 ASSERT(!no_failure.is_null()); 15842 ASSERT(!no_failure.is_null());
15846 i::USE(no_failure); 15843 USE(no_failure);
15847 CheckElementValue(isolate, 0, jsobj, 1); 15844 CheckElementValue(isolate, 0, jsobj, 1);
15848 15845
15849 result = CompileRun("for (var i = 0; i < 8; i++) {" 15846 result = CompileRun("for (var i = 0; i < 8; i++) {"
15850 " pixels[i] = (i * 65) - 109;" 15847 " pixels[i] = (i * 65) - 109;"
15851 "}" 15848 "}"
15852 "pixels[1] + pixels[6];"); 15849 "pixels[1] + pixels[6];");
15853 CHECK_EQ(255, result->Int32Value()); 15850 CHECK_EQ(255, result->Int32Value());
15854 CheckElementValue(isolate, 0, jsobj, 0); 15851 CheckElementValue(isolate, 0, jsobj, 0);
15855 CheckElementValue(isolate, 0, jsobj, 1); 15852 CheckElementValue(isolate, 0, jsobj, 1);
15856 CheckElementValue(isolate, 21, jsobj, 2); 15853 CheckElementValue(isolate, 21, jsobj, 2);
(...skipping 6784 matching lines...) Expand 10 before | Expand all | Expand 10 after
22641 Local<Script> script = v8::ScriptCompiler::Compile( 22638 Local<Script> script = v8::ScriptCompiler::Compile(
22642 isolate, &script_source); 22639 isolate, &script_source);
22643 Local<Value> script_name = script->GetUnboundScript()->GetScriptName(); 22640 Local<Value> script_name = script->GetUnboundScript()->GetScriptName();
22644 CHECK(!script_name.IsEmpty()); 22641 CHECK(!script_name.IsEmpty());
22645 CHECK(script_name->IsString()); 22642 CHECK(script_name->IsString());
22646 String::Utf8Value utf8_name(script_name); 22643 String::Utf8Value utf8_name(script_name);
22647 CHECK_EQ(url, *utf8_name); 22644 CHECK_EQ(url, *utf8_name);
22648 int line_number = script->GetUnboundScript()->GetLineNumber(0); 22645 int line_number = script->GetUnboundScript()->GetLineNumber(0);
22649 CHECK_EQ(13, line_number); 22646 CHECK_EQ(13, line_number);
22650 } 22647 }
OLDNEW
« no previous file with comments | « src/platform/mutex.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698