OLD | NEW |
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 17901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17912 | 17912 |
17913 Local<Object> instance1; | 17913 Local<Object> instance1; |
17914 Local<Object> instance2; | 17914 Local<Object> instance2; |
17915 | 17915 |
17916 { | 17916 { |
17917 Context::Scope scope(context3); | 17917 Context::Scope scope(context3); |
17918 instance1 = func1->NewInstance(); | 17918 instance1 = func1->NewInstance(); |
17919 instance2 = func2->NewInstance(); | 17919 instance2 = func2->NewInstance(); |
17920 } | 17920 } |
17921 | 17921 |
17922 CHECK(object1->CreationContext() == context1); | 17922 { |
17923 CheckContextId(object1, 1); | 17923 Handle<Context> other_context = Context::New(isolate); |
17924 CHECK(func1->CreationContext() == context1); | 17924 Context::Scope scope(other_context); |
17925 CheckContextId(func1, 1); | 17925 CHECK(object1->CreationContext() == context1); |
17926 CHECK(instance1->CreationContext() == context1); | 17926 CheckContextId(object1, 1); |
17927 CheckContextId(instance1, 1); | 17927 CHECK(func1->CreationContext() == context1); |
17928 CHECK(object2->CreationContext() == context2); | 17928 CheckContextId(func1, 1); |
17929 CheckContextId(object2, 2); | 17929 CHECK(instance1->CreationContext() == context1); |
17930 CHECK(func2->CreationContext() == context2); | 17930 CheckContextId(instance1, 1); |
17931 CheckContextId(func2, 2); | 17931 CHECK(object2->CreationContext() == context2); |
17932 CHECK(instance2->CreationContext() == context2); | 17932 CheckContextId(object2, 2); |
17933 CheckContextId(instance2, 2); | 17933 CHECK(func2->CreationContext() == context2); |
| 17934 CheckContextId(func2, 2); |
| 17935 CHECK(instance2->CreationContext() == context2); |
| 17936 CheckContextId(instance2, 2); |
| 17937 } |
17934 | 17938 |
17935 { | 17939 { |
17936 Context::Scope scope(context1); | 17940 Context::Scope scope(context1); |
17937 CHECK(object1->CreationContext() == context1); | 17941 CHECK(object1->CreationContext() == context1); |
17938 CheckContextId(object1, 1); | 17942 CheckContextId(object1, 1); |
17939 CHECK(func1->CreationContext() == context1); | 17943 CHECK(func1->CreationContext() == context1); |
17940 CheckContextId(func1, 1); | 17944 CheckContextId(func1, 1); |
17941 CHECK(instance1->CreationContext() == context1); | 17945 CHECK(instance1->CreationContext() == context1); |
17942 CheckContextId(instance1, 1); | 17946 CheckContextId(instance1, 1); |
17943 CHECK(object2->CreationContext() == context2); | 17947 CHECK(object2->CreationContext() == context2); |
(...skipping 26 matching lines...) Expand all Loading... |
17970 HandleScope handle_scope(CcTest::isolate()); | 17974 HandleScope handle_scope(CcTest::isolate()); |
17971 Handle<Context> context = Context::New(CcTest::isolate()); | 17975 Handle<Context> context = Context::New(CcTest::isolate()); |
17972 InstallContextId(context, 1); | 17976 InstallContextId(context, 1); |
17973 | 17977 |
17974 Local<Object> function; | 17978 Local<Object> function; |
17975 { | 17979 { |
17976 Context::Scope scope(context); | 17980 Context::Scope scope(context); |
17977 function = CompileRun("function foo() {}; foo").As<Object>(); | 17981 function = CompileRun("function foo() {}; foo").As<Object>(); |
17978 } | 17982 } |
17979 | 17983 |
| 17984 Handle<Context> other_context = Context::New(CcTest::isolate()); |
| 17985 Context::Scope scope(other_context); |
17980 CHECK(function->CreationContext() == context); | 17986 CHECK(function->CreationContext() == context); |
17981 CheckContextId(function, 1); | 17987 CheckContextId(function, 1); |
17982 } | 17988 } |
17983 | 17989 |
17984 | 17990 |
17985 void HasOwnPropertyIndexedPropertyGetter( | 17991 void HasOwnPropertyIndexedPropertyGetter( |
17986 uint32_t index, | 17992 uint32_t index, |
17987 const v8::PropertyCallbackInfo<v8::Value>& info) { | 17993 const v8::PropertyCallbackInfo<v8::Value>& info) { |
17988 if (index == 42) info.GetReturnValue().Set(v8_str("yes")); | 17994 if (index == 42) info.GetReturnValue().Set(v8_str("yes")); |
17989 } | 17995 } |
(...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21581 } | 21587 } |
21582 { | 21588 { |
21583 v8::TryCatch try_catch; | 21589 v8::TryCatch try_catch; |
21584 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); | 21590 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); |
21585 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, | 21591 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, |
21586 length).IsEmpty()); | 21592 length).IsEmpty()); |
21587 CHECK(try_catch.HasCaught()); | 21593 CHECK(try_catch.HasCaught()); |
21588 } | 21594 } |
21589 free(buffer); | 21595 free(buffer); |
21590 } | 21596 } |
OLD | NEW |