| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 | 219 |
| 220 THREADED_TEST(HandleScopePop) { | 220 THREADED_TEST(HandleScopePop) { |
| 221 v8::HandleScope scope; | 221 v8::HandleScope scope; |
| 222 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 222 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
| 223 obj->SetAccessor(v8_str("one"), HandleAllocatingGetter<1>); | 223 obj->SetAccessor(v8_str("one"), HandleAllocatingGetter<1>); |
| 224 obj->SetAccessor(v8_str("many"), HandleAllocatingGetter<1024>); | 224 obj->SetAccessor(v8_str("many"), HandleAllocatingGetter<1024>); |
| 225 LocalContext context; | 225 LocalContext context; |
| 226 v8::Handle<v8::Object> inst = obj->NewInstance(); | 226 v8::Handle<v8::Object> inst = obj->NewInstance(); |
| 227 context->Global()->Set(v8::String::New("obj"), inst); | 227 context->Global()->Set(v8::String::New("obj"), inst); |
| 228 int count_before = i::HandleScope::NumberOfHandles(); | 228 i::Isolate* isolate = i::Isolate::Current(); |
| 229 int count_before = i::HandleScope::NumberOfHandles(isolate); |
| 229 { | 230 { |
| 230 v8::HandleScope scope; | 231 v8::HandleScope scope; |
| 231 CompileRun( | 232 CompileRun( |
| 232 "for (var i = 0; i < 1000; i++) {" | 233 "for (var i = 0; i < 1000; i++) {" |
| 233 " obj.one;" | 234 " obj.one;" |
| 234 " obj.many;" | 235 " obj.many;" |
| 235 "}"); | 236 "}"); |
| 236 } | 237 } |
| 237 int count_after = i::HandleScope::NumberOfHandles(); | 238 int count_after = i::HandleScope::NumberOfHandles(isolate); |
| 238 CHECK_EQ(count_before, count_after); | 239 CHECK_EQ(count_before, count_after); |
| 239 } | 240 } |
| 240 | 241 |
| 241 static v8::Handle<Value> CheckAccessorArgsCorrect(Local<String> name, | 242 static v8::Handle<Value> CheckAccessorArgsCorrect(Local<String> name, |
| 242 const AccessorInfo& info) { | 243 const AccessorInfo& info) { |
| 243 CHECK(info.GetIsolate() == v8::Isolate::GetCurrent()); | 244 CHECK(info.GetIsolate() == v8::Isolate::GetCurrent()); |
| 244 CHECK(info.This() == info.Holder()); | 245 CHECK(info.This() == info.Holder()); |
| 245 CHECK(info.Data()->Equals(v8::String::New("data"))); | 246 CHECK(info.Data()->Equals(v8::String::New("data"))); |
| 246 ApiTestFuzzer::Fuzz(); | 247 ApiTestFuzzer::Fuzz(); |
| 247 CHECK(info.GetIsolate() == v8::Isolate::GetCurrent()); | 248 CHECK(info.GetIsolate() == v8::Isolate::GetCurrent()); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 v8::HandleScope scope; | 473 v8::HandleScope scope; |
| 473 LocalContext env; | 474 LocalContext env; |
| 474 | 475 |
| 475 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 476 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
| 476 obj->SetNamedPropertyHandler( | 477 obj->SetNamedPropertyHandler( |
| 477 JSONStringifyGetter, NULL, NULL, NULL, JSONStringifyEnumerator); | 478 JSONStringifyGetter, NULL, NULL, NULL, JSONStringifyEnumerator); |
| 478 env->Global()->Set(v8_str("obj"), obj->NewInstance()); | 479 env->Global()->Set(v8_str("obj"), obj->NewInstance()); |
| 479 v8::Handle<v8::String> expected = v8_str("{\"regress\":\"crbug-161028\"}"); | 480 v8::Handle<v8::String> expected = v8_str("{\"regress\":\"crbug-161028\"}"); |
| 480 CHECK(CompileRun("JSON.stringify(obj)")->Equals(expected)); | 481 CHECK(CompileRun("JSON.stringify(obj)")->Equals(expected)); |
| 481 } | 482 } |
| OLD | NEW |