| 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 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   2125   CHECK_EQ(32, context->Global()->Get(v8_num(16))->Int32Value()); |   2125   CHECK_EQ(32, context->Global()->Get(v8_num(16))->Int32Value()); | 
|   2126   CHECK_EQ(56, context->Global()->Get(v8::Integer::New(13))->Int32Value()); |   2126   CHECK_EQ(56, context->Global()->Get(v8::Integer::New(13))->Int32Value()); | 
|   2127   CHECK_EQ(56, context->Global()->Get(v8_str("13"))->Int32Value()); |   2127   CHECK_EQ(56, context->Global()->Get(v8_str("13"))->Int32Value()); | 
|   2128   CHECK_EQ(56, context->Global()->Get(v8_num(13))->Int32Value()); |   2128   CHECK_EQ(56, context->Global()->Get(v8_num(13))->Int32Value()); | 
|   2129 } |   2129 } | 
|   2130  |   2130  | 
|   2131  |   2131  | 
|   2132 THREADED_TEST(PropertyAttributes) { |   2132 THREADED_TEST(PropertyAttributes) { | 
|   2133   v8::HandleScope scope; |   2133   v8::HandleScope scope; | 
|   2134   LocalContext context; |   2134   LocalContext context; | 
 |   2135   // none | 
 |   2136   Local<String> prop = v8_str("none"); | 
 |   2137   context->Global()->Set(prop, v8_num(7)); | 
 |   2138   CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(prop)); | 
|   2135   // read-only |   2139   // read-only | 
|   2136   Local<String> prop = v8_str("read_only"); |   2140   prop = v8_str("read_only"); | 
|   2137   context->Global()->Set(prop, v8_num(7), v8::ReadOnly); |   2141   context->Global()->Set(prop, v8_num(7), v8::ReadOnly); | 
|   2138   CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); |   2142   CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); | 
 |   2143   CHECK_EQ(v8::ReadOnly, context->Global()->GetPropertyAttributes(prop)); | 
|   2139   Script::Compile(v8_str("read_only = 9"))->Run(); |   2144   Script::Compile(v8_str("read_only = 9"))->Run(); | 
|   2140   CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); |   2145   CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); | 
|   2141   context->Global()->Set(prop, v8_num(10)); |   2146   context->Global()->Set(prop, v8_num(10)); | 
|   2142   CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); |   2147   CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); | 
|   2143   // dont-delete |   2148   // dont-delete | 
|   2144   prop = v8_str("dont_delete"); |   2149   prop = v8_str("dont_delete"); | 
|   2145   context->Global()->Set(prop, v8_num(13), v8::DontDelete); |   2150   context->Global()->Set(prop, v8_num(13), v8::DontDelete); | 
|   2146   CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); |   2151   CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); | 
|   2147   Script::Compile(v8_str("delete dont_delete"))->Run(); |   2152   Script::Compile(v8_str("delete dont_delete"))->Run(); | 
|   2148   CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); |   2153   CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); | 
 |   2154   CHECK_EQ(v8::DontDelete, context->Global()->GetPropertyAttributes(prop)); | 
 |   2155   // dont-enum | 
 |   2156   prop = v8_str("dont_enum"); | 
 |   2157   context->Global()->Set(prop, v8_num(28), v8::DontEnum); | 
 |   2158   CHECK_EQ(v8::DontEnum, context->Global()->GetPropertyAttributes(prop)); | 
 |   2159   // absent | 
 |   2160   prop = v8_str("absent"); | 
 |   2161   CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(prop)); | 
 |   2162   Local<Value> fake_prop = v8_num(1); | 
 |   2163   CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(fake_prop)); | 
 |   2164   // exception | 
 |   2165   TryCatch try_catch; | 
 |   2166   Local<Value> exception = | 
 |   2167       CompileRun("({ toString: function() { throw 'exception';} })"); | 
 |   2168   CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(exception)); | 
 |   2169   CHECK(try_catch.HasCaught()); | 
 |   2170   String::AsciiValue exception_value(try_catch.Exception()); | 
 |   2171   CHECK_EQ("exception", *exception_value); | 
 |   2172   try_catch.Reset(); | 
|   2149 } |   2173 } | 
|   2150  |   2174  | 
|   2151  |   2175  | 
|   2152 THREADED_TEST(Array) { |   2176 THREADED_TEST(Array) { | 
|   2153   v8::HandleScope scope; |   2177   v8::HandleScope scope; | 
|   2154   LocalContext context; |   2178   LocalContext context; | 
|   2155   Local<v8::Array> array = v8::Array::New(); |   2179   Local<v8::Array> array = v8::Array::New(); | 
|   2156   CHECK_EQ(0, array->Length()); |   2180   CHECK_EQ(0, array->Length()); | 
|   2157   CHECK(array->Get(0)->IsUndefined()); |   2181   CHECK(array->Get(0)->IsUndefined()); | 
|   2158   CHECK(!array->Has(0)); |   2182   CHECK(!array->Has(0)); | 
| (...skipping 12604 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  14763   } |  14787   } | 
|  14764  |  14788  | 
|  14765   i::Isolate::Current()->heap()->CollectAllGarbage(true); |  14789   i::Isolate::Current()->heap()->CollectAllGarbage(true); | 
|  14766   { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); |  14790   { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); | 
|  14767     if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { |  14791     if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { | 
|  14768       i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); |  14792       i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); | 
|  14769       CHECK_GT(elements, map_cache->NumberOfElements()); |  14793       CHECK_GT(elements, map_cache->NumberOfElements()); | 
|  14770     } |  14794     } | 
|  14771   } |  14795   } | 
|  14772 } |  14796 } | 
| OLD | NEW |