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

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

Issue 895053002: Move the contents of api-natives.js to c++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « src/runtime/runtime-i18n.cc ('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 23307 matching lines...) Expand 10 before | Expand all | Expand 10 after
23318 function_new_expected_env = data; 23318 function_new_expected_env = data;
23319 Local<Function> func = Function::New(isolate, FunctionNewCallback, data); 23319 Local<Function> func = Function::New(isolate, FunctionNewCallback, data);
23320 env->Global()->Set(v8_str("func"), func); 23320 env->Global()->Set(v8_str("func"), func);
23321 Local<Value> result = CompileRun("func();"); 23321 Local<Value> result = CompileRun("func();");
23322 CHECK(v8::Integer::New(isolate, 17)->Equals(result)); 23322 CHECK(v8::Integer::New(isolate, 17)->Equals(result));
23323 // Verify function not cached 23323 // Verify function not cached
23324 int serial_number = 23324 int serial_number =
23325 i::Smi::cast(v8::Utils::OpenHandle(*func) 23325 i::Smi::cast(v8::Utils::OpenHandle(*func)
23326 ->shared()->get_api_func_data()->serial_number())->value(); 23326 ->shared()->get_api_func_data()->serial_number())->value();
23327 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 23327 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
23328 i::Handle<i::JSObject> cache(i_isolate->native_context()->function_cache()); 23328 i::Handle<i::FixedArray> cache(i_isolate->native_context()->function_cache());
23329 i::Handle<i::Object> elm = 23329 if (serial_number < cache->length()) {
23330 i::Object::GetElement(i_isolate, cache, serial_number).ToHandleChecked(); 23330 CHECK(cache->get(serial_number)->IsUndefined());
23331 CHECK(elm->IsUndefined()); 23331 }
23332 // Verify that each Function::New creates a new function instance 23332 // Verify that each Function::New creates a new function instance
23333 Local<Object> data2 = v8::Object::New(isolate); 23333 Local<Object> data2 = v8::Object::New(isolate);
23334 function_new_expected_env = data2; 23334 function_new_expected_env = data2;
23335 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); 23335 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2);
23336 CHECK(!func2->IsNull()); 23336 CHECK(!func2->IsNull());
23337 CHECK(!func->Equals(func2)); 23337 CHECK(!func->Equals(func2));
23338 env->Global()->Set(v8_str("func2"), func2); 23338 env->Global()->Set(v8_str("func2"), func2);
23339 Local<Value> result2 = CompileRun("func2();"); 23339 Local<Value> result2 = CompileRun("func2();");
23340 CHECK(v8::Integer::New(isolate, 17)->Equals(result2)); 23340 CHECK(v8::Integer::New(isolate, 17)->Equals(result2));
23341 } 23341 }
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
24890 "bar2.js"); 24890 "bar2.js");
24891 } 24891 }
24892 24892
24893 24893
24894 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { 24894 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) {
24895 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", 24895 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#",
24896 " sourceMappingURL=bar2.js\n", "foo();", NULL}; 24896 " sourceMappingURL=bar2.js\n", "foo();", NULL};
24897 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, 24897 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL,
24898 "bar2.js"); 24898 "bar2.js");
24899 } 24899 }
OLDNEW
« no previous file with comments | « src/runtime/runtime-i18n.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698