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

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

Issue 7552034: Allows not API functions as inputs for CreationConext method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 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/api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 14577 matching lines...) Expand 10 before | Expand all | Expand 10 after
14588 CHECK(instance2->CreationContext() == context2); 14588 CHECK(instance2->CreationContext() == context2);
14589 CheckContextId(instance2, 2); 14589 CheckContextId(instance2, 2);
14590 } 14590 }
14591 14591
14592 context1.Dispose(); 14592 context1.Dispose();
14593 context2.Dispose(); 14593 context2.Dispose();
14594 context3.Dispose(); 14594 context3.Dispose();
14595 } 14595 }
14596 14596
14597 14597
14598 THREADED_TEST(CreationContextOfJsFunction) {
14599 HandleScope handle_scope;
14600 Persistent<Context> context = Context::New();
14601 InstallContextId(context, 1);
14602
14603 Local<Object> function;
14604 {
14605 Context::Scope scope(context);
14606 function = CompileRun("function foo() {}; foo").As<Object>();
14607 }
14608
14609 CHECK(function->CreationContext() == context);
14610 CheckContextId(function, 1);
14611
14612 context.Dispose();
14613 }
14614
14615
14598 Handle<Value> HasOwnPropertyIndexedPropertyGetter(uint32_t index, 14616 Handle<Value> HasOwnPropertyIndexedPropertyGetter(uint32_t index,
14599 const AccessorInfo& info) { 14617 const AccessorInfo& info) {
14600 if (index == 42) return v8_str("yes"); 14618 if (index == 42) return v8_str("yes");
14601 return Handle<v8::Integer>(); 14619 return Handle<v8::Integer>();
14602 } 14620 }
14603 14621
14604 14622
14605 Handle<Value> HasOwnPropertyNamedPropertyGetter(Local<String> property, 14623 Handle<Value> HasOwnPropertyNamedPropertyGetter(Local<String> property,
14606 const AccessorInfo& info) { 14624 const AccessorInfo& info) {
14607 if (property->Equals(v8_str("foo"))) return v8_str("yes"); 14625 if (property->Equals(v8_str("foo"))) return v8_str("yes");
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
14830 } 14848 }
14831 14849
14832 i::Isolate::Current()->heap()->CollectAllGarbage(true); 14850 i::Isolate::Current()->heap()->CollectAllGarbage(true);
14833 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); 14851 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache();
14834 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { 14852 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) {
14835 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); 14853 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache);
14836 CHECK_GT(elements, map_cache->NumberOfElements()); 14854 CHECK_GT(elements, map_cache->NumberOfElements());
14837 } 14855 }
14838 } 14856 }
14839 } 14857 }
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698