OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // Must not crash. | 322 // Must not crash. |
323 CcTest::i_isolate()->logger()->LogCompiledFunctions(); | 323 CcTest::i_isolate()->logger()->LogCompiledFunctions(); |
324 } | 324 } |
325 | 325 |
326 | 326 |
327 static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) { | 327 static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) { |
328 } | 328 } |
329 | 329 |
330 | 330 |
331 TEST(LogCallbacks) { | 331 TEST(LogCallbacks) { |
| 332 v8::Isolate* isolate = CcTest::isolate(); |
332 ScopedLoggerInitializer initialize_logger; | 333 ScopedLoggerInitializer initialize_logger; |
333 Logger* logger = initialize_logger.logger(); | 334 Logger* logger = initialize_logger.logger(); |
334 | 335 |
335 v8::Local<v8::FunctionTemplate> obj = | 336 v8::Local<v8::FunctionTemplate> obj = |
336 v8::Local<v8::FunctionTemplate>::New(CcTest::isolate(), | 337 v8::Local<v8::FunctionTemplate>::New(isolate, |
337 v8::FunctionTemplate::New()); | 338 v8::FunctionTemplate::New(isolate)); |
338 obj->SetClassName(v8_str("Obj")); | 339 obj->SetClassName(v8_str("Obj")); |
339 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); | 340 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); |
340 v8::Local<v8::Signature> signature = | 341 v8::Local<v8::Signature> signature = |
341 v8::Signature::New(CcTest::isolate(), obj); | 342 v8::Signature::New(isolate, obj); |
342 proto->Set(v8_str("method1"), | 343 proto->Set(v8_str("method1"), |
343 v8::FunctionTemplate::New(ObjMethod1, | 344 v8::FunctionTemplate::New(isolate, |
| 345 ObjMethod1, |
344 v8::Handle<v8::Value>(), | 346 v8::Handle<v8::Value>(), |
345 signature), | 347 signature), |
346 static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 348 static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
347 | 349 |
348 initialize_logger.env()->Global()->Set(v8_str("Obj"), obj->GetFunction()); | 350 initialize_logger.env()->Global()->Set(v8_str("Obj"), obj->GetFunction()); |
349 CompileRun("Obj.prototype.method1.toString();"); | 351 CompileRun("Obj.prototype.method1.toString();"); |
350 | 352 |
351 logger->LogCompiledFunctions(); | 353 logger->LogCompiledFunctions(); |
352 | 354 |
353 bool exists = false; | 355 bool exists = false; |
(...skipping 18 matching lines...) Expand all Loading... |
372 v8::Local<v8::Value> value, | 374 v8::Local<v8::Value> value, |
373 const v8::PropertyCallbackInfo<void>& info) { | 375 const v8::PropertyCallbackInfo<void>& info) { |
374 } | 376 } |
375 | 377 |
376 static void Prop2Getter(v8::Local<v8::String> property, | 378 static void Prop2Getter(v8::Local<v8::String> property, |
377 const v8::PropertyCallbackInfo<v8::Value>& info) { | 379 const v8::PropertyCallbackInfo<v8::Value>& info) { |
378 } | 380 } |
379 | 381 |
380 | 382 |
381 TEST(LogAccessorCallbacks) { | 383 TEST(LogAccessorCallbacks) { |
| 384 v8::Isolate* isolate = CcTest::isolate(); |
382 ScopedLoggerInitializer initialize_logger; | 385 ScopedLoggerInitializer initialize_logger; |
383 Logger* logger = initialize_logger.logger(); | 386 Logger* logger = initialize_logger.logger(); |
384 | 387 |
385 v8::Local<v8::FunctionTemplate> obj = | 388 v8::Local<v8::FunctionTemplate> obj = |
386 v8::Local<v8::FunctionTemplate>::New(CcTest::isolate(), | 389 v8::Local<v8::FunctionTemplate>::New(isolate, |
387 v8::FunctionTemplate::New()); | 390 v8::FunctionTemplate::New(isolate)); |
388 obj->SetClassName(v8_str("Obj")); | 391 obj->SetClassName(v8_str("Obj")); |
389 v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate(); | 392 v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate(); |
390 inst->SetAccessor(v8_str("prop1"), Prop1Getter, Prop1Setter); | 393 inst->SetAccessor(v8_str("prop1"), Prop1Getter, Prop1Setter); |
391 inst->SetAccessor(v8_str("prop2"), Prop2Getter); | 394 inst->SetAccessor(v8_str("prop2"), Prop2Getter); |
392 | 395 |
393 logger->LogAccessorCallbacks(); | 396 logger->LogAccessorCallbacks(); |
394 | 397 |
395 bool exists = false; | 398 bool exists = false; |
396 i::Vector<const char> log( | 399 i::Vector<const char> log( |
397 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 400 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 v8::Local<v8::String> s = result->ToString(); | 483 v8::Local<v8::String> s = result->ToString(); |
481 i::ScopedVector<char> data(s->Utf8Length() + 1); | 484 i::ScopedVector<char> data(s->Utf8Length() + 1); |
482 CHECK_NE(NULL, data.start()); | 485 CHECK_NE(NULL, data.start()); |
483 s->WriteUtf8(data.start()); | 486 s->WriteUtf8(data.start()); |
484 printf("%s\n", data.start()); | 487 printf("%s\n", data.start()); |
485 // Make sure that our output is written prior crash due to CHECK failure. | 488 // Make sure that our output is written prior crash due to CHECK failure. |
486 fflush(stdout); | 489 fflush(stdout); |
487 CHECK(false); | 490 CHECK(false); |
488 } | 491 } |
489 } | 492 } |
OLD | NEW |