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

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

Issue 150101: Tweaks to global object inline cache code (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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 | « src/stub-cache.cc ('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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 6131 matching lines...) Expand 10 before | Expand all | Expand 10 after
6142 Local<Function> g2 = 6142 Local<Function> g2 =
6143 Local<Function>::Cast(context->Global()->Get(v8_str("g2"))); 6143 Local<Function>::Cast(context->Global()->Get(v8_str("g2")));
6144 Local<Function> h = 6144 Local<Function> h =
6145 Local<Function>::Cast(context->Global()->Get(v8_str("h"))); 6145 Local<Function>::Cast(context->Global()->Get(v8_str("h")));
6146 6146
6147 // Get the global object. 6147 // Get the global object.
6148 v8::Handle<v8::Object> global = context->Global(); 6148 v8::Handle<v8::Object> global = context->Global();
6149 6149
6150 // Call f1 one time and f2 a number of times. This will ensure that f1 still 6150 // Call f1 one time and f2 a number of times. This will ensure that f1 still
6151 // uses the runtime system to retreive property a whereas f2 uses global load 6151 // uses the runtime system to retreive property a whereas f2 uses global load
6152 // inline cache is used. 6152 // inline cache.
6153 CHECK(!f1->Call(global, 0, NULL)->IsUndefined()); 6153 CHECK(f1->Call(global, 0, NULL)->Equals(v8_num(1)));
6154 for (int i = 0; i < 4; i++) { 6154 for (int i = 0; i < 4; i++) {
6155 CHECK(!f2->Call(global, 0, NULL)->IsUndefined()); 6155 CHECK(f2->Call(global, 0, NULL)->Equals(v8_num(1)));
6156 } 6156 }
6157 6157
6158 // Same for g1 and g2. 6158 // Same for g1 and g2.
6159 CHECK(!g1->Call(global, 0, NULL)->IsUndefined()); 6159 CHECK(g1->Call(global, 0, NULL)->Equals(v8_num(1)));
6160 for (int i = 0; i < 4; i++) { 6160 for (int i = 0; i < 4; i++) {
6161 CHECK(!g2->Call(global, 0, NULL)->IsUndefined()); 6161 CHECK(g2->Call(global, 0, NULL)->Equals(v8_num(1)));
6162 } 6162 }
6163 6163
6164 // Detach the global and turn on access check. 6164 // Detach the global and turn on access check.
6165 context->DetachGlobal(); 6165 context->DetachGlobal();
6166 context->Global()->TurnOnAccessCheck(); 6166 context->Global()->TurnOnAccessCheck();
6167 6167
6168 // Failing access check to property get results in undefined. 6168 // Failing access check to property get results in undefined.
6169 CHECK(f1->Call(global, 0, NULL)->IsUndefined()); 6169 CHECK(f1->Call(global, 0, NULL)->IsUndefined());
6170 CHECK(f2->Call(global, 0, NULL)->IsUndefined()); 6170 CHECK(f2->Call(global, 0, NULL)->IsUndefined());
6171 6171
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
7017 calling_context2->Exit(); 7017 calling_context2->Exit();
7018 7018
7019 // Dispose the contexts to allow them to be garbage collected. 7019 // Dispose the contexts to allow them to be garbage collected.
7020 calling_context0.Dispose(); 7020 calling_context0.Dispose();
7021 calling_context1.Dispose(); 7021 calling_context1.Dispose();
7022 calling_context2.Dispose(); 7022 calling_context2.Dispose();
7023 calling_context0.Clear(); 7023 calling_context0.Clear();
7024 calling_context1.Clear(); 7024 calling_context1.Clear();
7025 calling_context2.Clear(); 7025 calling_context2.Clear();
7026 } 7026 }
OLDNEW
« no previous file with comments | « src/stub-cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698