| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 CHECK_EQ(count_before, count_after); | 236 CHECK_EQ(count_before, count_after); |
| 237 } | 237 } |
| 238 | 238 |
| 239 static v8::Handle<Value> CheckAccessorArgsCorrect(Local<String> name, | 239 static v8::Handle<Value> CheckAccessorArgsCorrect(Local<String> name, |
| 240 const AccessorInfo& info) { | 240 const AccessorInfo& info) { |
| 241 CHECK(info.This() == info.Holder()); | 241 CHECK(info.This() == info.Holder()); |
| 242 CHECK(info.Data()->Equals(v8::String::New("data"))); | 242 CHECK(info.Data()->Equals(v8::String::New("data"))); |
| 243 ApiTestFuzzer::Fuzz(); | 243 ApiTestFuzzer::Fuzz(); |
| 244 CHECK(info.This() == info.Holder()); | 244 CHECK(info.This() == info.Holder()); |
| 245 CHECK(info.Data()->Equals(v8::String::New("data"))); | 245 CHECK(info.Data()->Equals(v8::String::New("data"))); |
| 246 i::Heap::CollectAllGarbage(true); | 246 HEAP->CollectAllGarbage(true); |
| 247 CHECK(info.This() == info.Holder()); | 247 CHECK(info.This() == info.Holder()); |
| 248 CHECK(info.Data()->Equals(v8::String::New("data"))); | 248 CHECK(info.Data()->Equals(v8::String::New("data"))); |
| 249 return v8::Integer::New(17); | 249 return v8::Integer::New(17); |
| 250 } | 250 } |
| 251 | 251 |
| 252 THREADED_TEST(DirectCall) { | 252 THREADED_TEST(DirectCall) { |
| 253 v8::HandleScope scope; | 253 v8::HandleScope scope; |
| 254 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 254 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
| 255 obj->SetAccessor(v8_str("xxx"), | 255 obj->SetAccessor(v8_str("xxx"), |
| 256 CheckAccessorArgsCorrect, | 256 CheckAccessorArgsCorrect, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 "}"))->Run(); | 390 "}"))->Run(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 | 393 |
| 394 static v8::Handle<Value> StackCheck(Local<String> name, | 394 static v8::Handle<Value> StackCheck(Local<String> name, |
| 395 const AccessorInfo& info) { | 395 const AccessorInfo& info) { |
| 396 i::StackFrameIterator iter; | 396 i::StackFrameIterator iter; |
| 397 for (int i = 0; !iter.done(); i++) { | 397 for (int i = 0; !iter.done(); i++) { |
| 398 i::StackFrame* frame = iter.frame(); | 398 i::StackFrame* frame = iter.frame(); |
| 399 CHECK(i != 0 || (frame->type() == i::StackFrame::EXIT)); | 399 CHECK(i != 0 || (frame->type() == i::StackFrame::EXIT)); |
| 400 CHECK(frame->code()->IsCode()); | 400 i::Code* code = frame->LookupCode(i::Isolate::Current()); |
| 401 CHECK(code->IsCode()); |
| 401 i::Address pc = frame->pc(); | 402 i::Address pc = frame->pc(); |
| 402 i::Code* code = frame->code(); | |
| 403 CHECK(code->contains(pc)); | 403 CHECK(code->contains(pc)); |
| 404 iter.Advance(); | 404 iter.Advance(); |
| 405 } | 405 } |
| 406 return v8::Undefined(); | 406 return v8::Undefined(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 THREADED_TEST(StackIteration) { | 410 THREADED_TEST(StackIteration) { |
| 411 v8::HandleScope scope; | 411 v8::HandleScope scope; |
| 412 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 412 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 441 obj->SetAccessor(v8_str("xxx"), AllocateHandles); | 441 obj->SetAccessor(v8_str("xxx"), AllocateHandles); |
| 442 LocalContext env; | 442 LocalContext env; |
| 443 env->Global()->Set(v8_str("obj"), obj->NewInstance()); | 443 env->Global()->Set(v8_str("obj"), obj->NewInstance()); |
| 444 v8::Handle<v8::Value> result = Script::Compile(String::New( | 444 v8::Handle<v8::Value> result = Script::Compile(String::New( |
| 445 "var result;" | 445 "var result;" |
| 446 "for (var i = 0; i < 4; i++)" | 446 "for (var i = 0; i < 4; i++)" |
| 447 " result = obj.xxx;" | 447 " result = obj.xxx;" |
| 448 "result;"))->Run(); | 448 "result;"))->Run(); |
| 449 CHECK_EQ(100, result->Int32Value()); | 449 CHECK_EQ(100, result->Int32Value()); |
| 450 } | 450 } |
| OLD | NEW |