Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: test/cctest/test-api.cc

Issue 177343002: Allow Object::InternalFieldCount and Object::GetAlignedPointerFromInternalField to be called from P… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2616 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 2627
2628 int* heap_allocated = new int[100]; 2628 int* heap_allocated = new int[100];
2629 CheckAlignedPointerInInternalField(obj, heap_allocated); 2629 CheckAlignedPointerInInternalField(obj, heap_allocated);
2630 delete[] heap_allocated; 2630 delete[] heap_allocated;
2631 2631
2632 int stack_allocated[100]; 2632 int stack_allocated[100];
2633 CheckAlignedPointerInInternalField(obj, stack_allocated); 2633 CheckAlignedPointerInInternalField(obj, stack_allocated);
2634 2634
2635 void* huge = reinterpret_cast<void*>(~static_cast<uintptr_t>(1)); 2635 void* huge = reinterpret_cast<void*>(~static_cast<uintptr_t>(1));
2636 CheckAlignedPointerInInternalField(obj, huge); 2636 CheckAlignedPointerInInternalField(obj, huge);
2637
2638 v8::UniquePersistent<v8::Object> persistent(isolate, obj);
2639 CHECK_EQ(1, Object::InternalFieldCount(persistent));
2640 CHECK_EQ(huge, Object::GetAlignedPointerFromInternalField(persistent, 0));
2637 } 2641 }
2638 2642
2639 2643
2640 static void CheckAlignedPointerInEmbedderData(LocalContext* env, 2644 static void CheckAlignedPointerInEmbedderData(LocalContext* env,
2641 int index, 2645 int index,
2642 void* value) { 2646 void* value) {
2643 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1)); 2647 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1));
2644 (*env)->SetAlignedPointerInEmbedderData(index, value); 2648 (*env)->SetAlignedPointerInEmbedderData(index, value);
2645 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 2649 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
2646 CHECK_EQ(value, (*env)->GetAlignedPointerFromEmbedderData(index)); 2650 CHECK_EQ(value, (*env)->GetAlignedPointerFromEmbedderData(index));
(...skipping 19462 matching lines...) Expand 10 before | Expand all | Expand 10 after
22109 Local<Object> ApiCallOptimizationChecker::holder; 22113 Local<Object> ApiCallOptimizationChecker::holder;
22110 Local<Object> ApiCallOptimizationChecker::callee; 22114 Local<Object> ApiCallOptimizationChecker::callee;
22111 int ApiCallOptimizationChecker::count = 0; 22115 int ApiCallOptimizationChecker::count = 0;
22112 22116
22113 22117
22114 TEST(TestFunctionCallOptimization) { 22118 TEST(TestFunctionCallOptimization) {
22115 i::FLAG_allow_natives_syntax = true; 22119 i::FLAG_allow_natives_syntax = true;
22116 ApiCallOptimizationChecker checker; 22120 ApiCallOptimizationChecker checker;
22117 checker.RunAll(); 22121 checker.RunAll();
22118 } 22122 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698