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

Side by Side Diff: src/api.cc

Issue 189913023: Use a per-isolate cache for the date object JS bits (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 9 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 | « no previous file | src/date.js » ('j') | 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 5600 matching lines...) Expand 10 before | Expand all | Expand 10 after
5611 5611
5612 void v8::Date::DateTimeConfigurationChangeNotification(Isolate* isolate) { 5612 void v8::Date::DateTimeConfigurationChangeNotification(Isolate* isolate) {
5613 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 5613 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5614 ON_BAILOUT(i_isolate, "v8::Date::DateTimeConfigurationChangeNotification()", 5614 ON_BAILOUT(i_isolate, "v8::Date::DateTimeConfigurationChangeNotification()",
5615 return); 5615 return);
5616 LOG_API(i_isolate, "Date::DateTimeConfigurationChangeNotification"); 5616 LOG_API(i_isolate, "Date::DateTimeConfigurationChangeNotification");
5617 ENTER_V8(i_isolate); 5617 ENTER_V8(i_isolate);
5618 5618
5619 i_isolate->date_cache()->ResetDateCache(); 5619 i_isolate->date_cache()->ResetDateCache();
5620 5620
5621 i::HandleScope scope(i_isolate); 5621 if (!i_isolate->eternal_handles()->Exists(
5622 // Get the function ResetDateCache (defined in date.js). 5622 i::EternalHandles::DATE_CACHE_VERSION)) {
5623 i::Handle<i::String> func_name_str =
5624 i_isolate->factory()->InternalizeOneByteString(
5625 STATIC_ASCII_VECTOR("ResetDateCache"));
5626 i::MaybeObject* result =
5627 i_isolate->js_builtins_object()->GetProperty(*func_name_str);
5628 i::Object* object_func;
5629 if (!result->ToObject(&object_func)) {
5630 return; 5623 return;
5631 } 5624 }
5632 5625 i::Handle<i::FixedArray> date_cache_version =
5633 if (object_func->IsJSFunction()) { 5626 i::Handle<i::FixedArray>::cast(i_isolate->eternal_handles()->GetSingleton(
5634 i::Handle<i::JSFunction> func = 5627 i::EternalHandles::DATE_CACHE_VERSION));
5635 i::Handle<i::JSFunction>(i::JSFunction::cast(object_func)); 5628 ASSERT_EQ(1, date_cache_version->length());
5636 5629 ASSERT(date_cache_version->get(0)->IsNumber());
5637 // Call ResetDateCache(0 but expect no exceptions: 5630 date_cache_version->set(0, i::Smi::FromInt(
5638 bool caught_exception = false; 5631 date_cache_version->get(0)->Number() + 1));
5639 i::Execution::TryCall(func,
5640 i_isolate->js_builtins_object(),
5641 0,
5642 NULL,
5643 &caught_exception);
5644 }
5645 } 5632 }
5646 5633
5647 5634
5648 static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) { 5635 static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) {
5649 i::Isolate* isolate = i::Isolate::Current(); 5636 i::Isolate* isolate = i::Isolate::Current();
5650 uint8_t flags_buf[3]; 5637 uint8_t flags_buf[3];
5651 int num_flags = 0; 5638 int num_flags = 0;
5652 if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g'; 5639 if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g';
5653 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm'; 5640 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm';
5654 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i'; 5641 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i';
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
7342 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7329 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7343 Address callback_address = 7330 Address callback_address =
7344 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7331 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7345 VMState<EXTERNAL> state(isolate); 7332 VMState<EXTERNAL> state(isolate);
7346 ExternalCallbackScope call_scope(isolate, callback_address); 7333 ExternalCallbackScope call_scope(isolate, callback_address);
7347 callback(info); 7334 callback(info);
7348 } 7335 }
7349 7336
7350 7337
7351 } } // namespace v8::internal 7338 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698