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 8590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8601 LocalContext context; | 8601 LocalContext context; |
8602 context->Global()->Set(v8_str("o"), templ->NewInstance()); | 8602 context->Global()->Set(v8_str("o"), templ->NewInstance()); |
8603 v8::Handle<Value> value = CompileRun(source); | 8603 v8::Handle<Value> value = CompileRun(source); |
8604 CHECK_EQ(expected, value->Int32Value()); | 8604 CHECK_EQ(expected, value->Int32Value()); |
8605 } | 8605 } |
8606 | 8606 |
8607 | 8607 |
8608 static v8::Handle<Value> InterceptorLoadICGetter(Local<String> name, | 8608 static v8::Handle<Value> InterceptorLoadICGetter(Local<String> name, |
8609 const AccessorInfo& info) { | 8609 const AccessorInfo& info) { |
8610 ApiTestFuzzer::Fuzz(); | 8610 ApiTestFuzzer::Fuzz(); |
| 8611 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 8612 CHECK_EQ(isolate, info.GetIsolate()); |
8611 CHECK_EQ(v8_str("data"), info.Data()); | 8613 CHECK_EQ(v8_str("data"), info.Data()); |
8612 CHECK_EQ(v8_str("x"), name); | 8614 CHECK_EQ(v8_str("x"), name); |
8613 return v8::Integer::New(42); | 8615 return v8::Integer::New(42); |
8614 } | 8616 } |
8615 | 8617 |
8616 | 8618 |
8617 // This test should hit the load IC for the interceptor case. | 8619 // This test should hit the load IC for the interceptor case. |
8618 THREADED_TEST(InterceptorLoadIC) { | 8620 THREADED_TEST(InterceptorLoadIC) { |
8619 CheckInterceptorLoadIC(InterceptorLoadICGetter, | 8621 CheckInterceptorLoadIC(InterceptorLoadICGetter, |
8620 "var result = 0;" | 8622 "var result = 0;" |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9327 ++(*call_count); | 9329 ++(*call_count); |
9328 if ((*call_count) % 20 == 0) { | 9330 if ((*call_count) % 20 == 0) { |
9329 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 9331 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
9330 } | 9332 } |
9331 return v8::Handle<Value>(); | 9333 return v8::Handle<Value>(); |
9332 } | 9334 } |
9333 | 9335 |
9334 static v8::Handle<Value> FastApiCallback_TrivialSignature( | 9336 static v8::Handle<Value> FastApiCallback_TrivialSignature( |
9335 const v8::Arguments& args) { | 9337 const v8::Arguments& args) { |
9336 ApiTestFuzzer::Fuzz(); | 9338 ApiTestFuzzer::Fuzz(); |
| 9339 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 9340 CHECK_EQ(isolate, args.GetIsolate()); |
9337 CHECK_EQ(args.This(), args.Holder()); | 9341 CHECK_EQ(args.This(), args.Holder()); |
9338 CHECK(args.Data()->Equals(v8_str("method_data"))); | 9342 CHECK(args.Data()->Equals(v8_str("method_data"))); |
9339 return v8::Integer::New(args[0]->Int32Value() + 1); | 9343 return v8::Integer::New(args[0]->Int32Value() + 1); |
9340 } | 9344 } |
9341 | 9345 |
9342 static v8::Handle<Value> FastApiCallback_SimpleSignature( | 9346 static v8::Handle<Value> FastApiCallback_SimpleSignature( |
9343 const v8::Arguments& args) { | 9347 const v8::Arguments& args) { |
9344 ApiTestFuzzer::Fuzz(); | 9348 ApiTestFuzzer::Fuzz(); |
| 9349 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 9350 CHECK_EQ(isolate, args.GetIsolate()); |
9345 CHECK_EQ(args.This()->GetPrototype(), args.Holder()); | 9351 CHECK_EQ(args.This()->GetPrototype(), args.Holder()); |
9346 CHECK(args.Data()->Equals(v8_str("method_data"))); | 9352 CHECK(args.Data()->Equals(v8_str("method_data"))); |
9347 // Note, we're using HasRealNamedProperty instead of Has to avoid | 9353 // Note, we're using HasRealNamedProperty instead of Has to avoid |
9348 // invoking the interceptor again. | 9354 // invoking the interceptor again. |
9349 CHECK(args.Holder()->HasRealNamedProperty(v8_str("foo"))); | 9355 CHECK(args.Holder()->HasRealNamedProperty(v8_str("foo"))); |
9350 return v8::Integer::New(args[0]->Int32Value() + 1); | 9356 return v8::Integer::New(args[0]->Int32Value() + 1); |
9351 } | 9357 } |
9352 | 9358 |
9353 // Helper to maximize the odds of object moving. | 9359 // Helper to maximize the odds of object moving. |
9354 static void GenerateSomeGarbage() { | 9360 static void GenerateSomeGarbage() { |
(...skipping 7044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16399 | 16405 |
16400 TEST(SecondaryStubCache) { | 16406 TEST(SecondaryStubCache) { |
16401 StubCacheHelper(true); | 16407 StubCacheHelper(true); |
16402 } | 16408 } |
16403 | 16409 |
16404 | 16410 |
16405 TEST(PrimaryStubCache) { | 16411 TEST(PrimaryStubCache) { |
16406 StubCacheHelper(false); | 16412 StubCacheHelper(false); |
16407 } | 16413 } |
16408 | 16414 |
OLD | NEW |