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