| OLD | NEW |
| 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 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 CHECK_EQ(32, context->Global()->Get(v8_num(16))->Int32Value()); | 2041 CHECK_EQ(32, context->Global()->Get(v8_num(16))->Int32Value()); |
| 2042 CHECK_EQ(56, context->Global()->Get(v8::Integer::New(13))->Int32Value()); | 2042 CHECK_EQ(56, context->Global()->Get(v8::Integer::New(13))->Int32Value()); |
| 2043 CHECK_EQ(56, context->Global()->Get(v8_str("13"))->Int32Value()); | 2043 CHECK_EQ(56, context->Global()->Get(v8_str("13"))->Int32Value()); |
| 2044 CHECK_EQ(56, context->Global()->Get(v8_num(13))->Int32Value()); | 2044 CHECK_EQ(56, context->Global()->Get(v8_num(13))->Int32Value()); |
| 2045 } | 2045 } |
| 2046 | 2046 |
| 2047 | 2047 |
| 2048 THREADED_TEST(PropertyAttributes) { | 2048 THREADED_TEST(PropertyAttributes) { |
| 2049 v8::HandleScope scope; | 2049 v8::HandleScope scope; |
| 2050 LocalContext context; | 2050 LocalContext context; |
| 2051 // none |
| 2052 Local<String> prop = v8_str("none"); |
| 2053 context->Global()->Set(prop, v8_num(7)); |
| 2054 CHECK_EQ(v8::None, context->Global()->GetPropertyAttribute(prop)); |
| 2051 // read-only | 2055 // read-only |
| 2052 Local<String> prop = v8_str("read_only"); | 2056 prop = v8_str("read_only"); |
| 2053 context->Global()->Set(prop, v8_num(7), v8::ReadOnly); | 2057 context->Global()->Set(prop, v8_num(7), v8::ReadOnly); |
| 2054 CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); | 2058 CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); |
| 2059 CHECK_EQ(v8::ReadOnly, context->Global()->GetPropertyAttribute(prop)); |
| 2055 Script::Compile(v8_str("read_only = 9"))->Run(); | 2060 Script::Compile(v8_str("read_only = 9"))->Run(); |
| 2056 CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); | 2061 CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); |
| 2057 context->Global()->Set(prop, v8_num(10)); | 2062 context->Global()->Set(prop, v8_num(10)); |
| 2058 CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); | 2063 CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); |
| 2059 // dont-delete | 2064 // dont-delete |
| 2060 prop = v8_str("dont_delete"); | 2065 prop = v8_str("dont_delete"); |
| 2061 context->Global()->Set(prop, v8_num(13), v8::DontDelete); | 2066 context->Global()->Set(prop, v8_num(13), v8::DontDelete); |
| 2062 CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); | 2067 CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); |
| 2063 Script::Compile(v8_str("delete dont_delete"))->Run(); | 2068 Script::Compile(v8_str("delete dont_delete"))->Run(); |
| 2064 CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); | 2069 CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); |
| 2070 CHECK_EQ(v8::DontDelete, context->Global()->GetPropertyAttribute(prop)); |
| 2071 // dont-enum |
| 2072 prop = v8_str("dont_enum"); |
| 2073 context->Global()->Set(prop, v8_num(28), v8::DontEnum); |
| 2074 CHECK_EQ(v8::DontEnum, context->Global()->GetPropertyAttribute(prop)); |
| 2065 } | 2075 } |
| 2066 | 2076 |
| 2067 | 2077 |
| 2068 THREADED_TEST(Array) { | 2078 THREADED_TEST(Array) { |
| 2069 v8::HandleScope scope; | 2079 v8::HandleScope scope; |
| 2070 LocalContext context; | 2080 LocalContext context; |
| 2071 Local<v8::Array> array = v8::Array::New(); | 2081 Local<v8::Array> array = v8::Array::New(); |
| 2072 CHECK_EQ(0, array->Length()); | 2082 CHECK_EQ(0, array->Length()); |
| 2073 CHECK(array->Get(0)->IsUndefined()); | 2083 CHECK(array->Get(0)->IsUndefined()); |
| 2074 CHECK(!array->Has(0)); | 2084 CHECK(!array->Has(0)); |
| (...skipping 12602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14677 } | 14687 } |
| 14678 | 14688 |
| 14679 i::Isolate::Current()->heap()->CollectAllGarbage(true); | 14689 i::Isolate::Current()->heap()->CollectAllGarbage(true); |
| 14680 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); | 14690 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); |
| 14681 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { | 14691 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { |
| 14682 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); | 14692 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); |
| 14683 CHECK_GT(elements, map_cache->NumberOfElements()); | 14693 CHECK_GT(elements, map_cache->NumberOfElements()); |
| 14684 } | 14694 } |
| 14685 } | 14695 } |
| 14686 } | 14696 } |
| OLD | NEW |